In today's internet operations, many businesses or individuals often need to manage multiple websites to serve different brands, products, or target audiences.AnQiCMS (AnQiCMS) with its powerful multi-site management capabilities, can easily meet this requirement on a single core system.When deploying with Docker, a popular containerization technology, how to ensure that each site can run efficiently and independently display its content and configuration becomes a topic worth discussing.

The AnQi CMS implements independent display of multiple sites in the Docker environment, the core lies in understanding the system architecture design and the Docker network proxy mechanism.It allows you to run multiple logical sites with different domains pointing to an AnQiCMS instance (usually running in a Docker container), and these sites are completely independent in terms of content, templates, and settings.

Understand the independent mechanism of multiple sites in AnQi CMS

The reason why AnQi CMS can support independent display of multiple sites is due to its exquisite design concept.It is not simply a copy of multiple programs, but uses a unified core program to manage data for multiple independent sites.This means that, although all your websites may share the same AnqiCMS Docker container instance, each site:

  1. Content data: Articles, products, categories, tags, single pages, etc., are stored in separate independent database tables or distinguished by database naming.
  2. Configuration informationWebsite name, Logo, filing number, copyright information, contact information, TDK (Title, Description, Keywords) settings, even the background administrator account and password, are all exclusive to the site.
  3. Template StyleEach site can choose or customize different templates to achieve a completely unique visual style.

This architecture greatly simplifies the deployment and maintenance of multi-sites, improves resource utilization, and also ensures the independence and data security between sites.

Basic Deployment in Docker Environment

To deploy AnqiCMS in Docker and support multiple sites, you first need a Docker container running AnqiCMS and use a reverse proxy to import external traffic.

  1. Deploy AnqiCMS Docker container: You would usually use something similaranqicms/anqicms:latestSuch a Docker image to create a container and map the internal listening port (default 8001) to a port on the host machine.For example, mapping to the host's 8001 port.

  2. Configure reverse proxy (Nginx/Apache)This is a critical step in achieving independent display of multiple sites. The reverse proxy server (such as Nginx or Apache) acts as a gatekeeper for external requests. When you havesite1.comandsite2.comWhen you have two domain names, you need to configure reverse proxy:

    • tosite1.comThe request should be forwarded to the host port listened by the AnqiCMS Docker container (for example)127.0.0.1:8001)
    • tosite2.comThe request should also be forwarded tothe samePort that the AnqiCMS Docker container listens on (127.0.0.1:8001)

    In this way, all requests from different domain names will eventually reach the same AnqiCMS container instance. AnqiCMS will use the information in the request headers ofHostThe field (i.e., the domain visited) is used to identify which site's request it is, and to load the corresponding site data and configuration.

Configure independent sites and content in the AnQi CMS backend.

Once the Docker container and reverse proxy are ready, all the independence configurations will be completed in the AnqiCMS backend.

  1. Access the main site backend: Access the AnqiCMS main station backend through the first configured domain (for examplehttp://site1.com/system/)

  2. Add a new siteIn the left menu of the AnqiCMS backend, find the "Multi-site Management" function, click "Add New Site". Here, you need to configure the new site in detail, which is a core step to ensure its independence:

    • Site name: Name the new site for easy identification and management in the background.
    • Site root directory:This is one of the keys to achieve data independence.AnqiCMS will use this directory to store the independent files of the site, such as cache, uploaded resources, etc. In the Docker environment, this path will usually be/app/starts with a unique directory name, for example, replacing the dots in the domain with underscores likedev_anqicms_comthe final path might be/app/dev_anqicms_commake sure that the root directory of each site isUnique and not repeated.
    • website address: Enter the full domain name of the new site (for examplehttp://site2.com) This is the basis for AnqiCMS to identify different sites.
    • Administrator account passwordSet an independent backend login account and password for the new site.
    • Database name:This is the core of achieving content independence.Each AnqiCMS site requires an independent database to store articles, products, categories, and other data. You can create a new database name, for example, in the same domain transformation form, such asdev_anqicms_comEnsure that the database name for each site is alsoUnique and not repeated.
    • Duplicate database informationIf all AnqiCMS sites in your Docker deployment use the same database server (for example, a MySQL container in Docker), you can choose to 'reuse the default database account information' and do not need to re-enter the database connection credentials.
    • Select the template to use: Choose a dedicated template for the new site. AnqiCMS will store the template files in/templateUnder each directory, each site can specify its own template directory, thus achieving a completely independent page style.

After completing the above configuration, click OK to create and activate a new, independent AnqiCMS site. At this point, bysite2.comvisiting, you will see a new, unique andsite1.comThe website content and configuration are completely independent sites.

The key to isolating the template from the content

By the above steps, each site has achieved high isolation at the logical and data levels:

  • Content independent: As each site is bound to a unique database name, all of its articles, categories, single pages, tags, and other content are stored in their respective databases, without interference. When you aresite1.comWhen published on the backend, it will only display insite1.comwhilesite2.comwill display its independent article.
  • Configure independentlyIn the AnqiCMS backend "Backend Settings" section, for example, "Global Function Settings", "Contact Information Settings", "Home Page TDK Settings", etc., any modifications made to a specific site will only affect that site and not others.
  • Template independent: The template chosen when each site is created will determine its frontend display style. You can design a completely different template for each site or