In the operation of the Internet today, many companies or individuals often need to manage multiple websites to serve different brands, products, or target audiences.English CMS (EnglishCMS) can easily meet this requirement with its powerful multi-site management capabilities 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.

Understanding 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 does not simply copy multiple sets of programs, but instead uses a unified core program to manage data for multiple independent sites.

  1. Content dataThe articles, products, categories, tags, single pages, etc., are all stored in separate database tables, or distinguished by database naming.
  2. Configuration information:Website name, Logo, filing number, copyright information, contact information, TDK (Title, Description, Keywords) settings, even the back-end 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 multiple sites, improves resource utilization, and also ensures the independence and data security between sites.

Deployment Basics in Docker Environment

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

  1. Deploy AnqiCMS Docker container Usually, you would use something likeanqicms/anqicms:latestCreate a Docker container with such an image and map its internal listening port (default is 8001) to a port on the host machine.For example, map to the host's 8001 port.

  2. Configure reverse proxy (Nginx/Apache): This is a critical step in implementing independent display for multiple sites. Reverse proxy servers (such as Nginx or Apache) act as 'guards' for external requests. When you havesite1.comandsite2.comWhen you have two domain names, you need to configure reverse proxy:

    • tosite1.comforward requests to the host port that the AnqiCMS Docker container is listening on (for example127.0.0.1:8001).
    • tosite2.comforward requests tothe sameAnqiCMS Docker container listens on the host port (English)127.0.0.1:8001).

    Here, all requests to different domain names will eventually reach the same AnqiCMS container instance. AnqiCMS will process the requests based on the request headers containingHostField (i.e., the domain accessed) 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 configuration will be completed in the AnqiCMS backend.

  1. Access the main station backend: Through the first configured domain to access the AnqiCMS main station's backend (for examplehttp://site1.com/system/).

  2. Add a new site: In the left menu of AnqiCMS backend, find the 'Multi-site Management' feature and click 'Add New Site'. Here, you need to perform detailed configuration for the new site, which is the core step to ensure its independence:

    • Site NameThis is used to name the new site, which is convenient for background identification and management.
    • Site Root Directory:This is one of the key factors for achieving data independence.AnqiCMS will use this directory to store the independent files of this site, such as cache, uploaded resources, etc. In the Docker environment, this path is usually set to/app/The beginning follows with a unique directory name, for example, replacing the dots in the domain with underscores, such asdev_anqicms_comThe final path might be/app/dev_anqicms_comEnsure that each site's root directory isUnique and non-repetitive.
    • Website addressPlease enter the full domain name of the new site (for example)http://site2.com). This is the basis for AnqiCMS to identify different sites.
    • Administrator account passwordThis is to set up an independent backend login account and password for the new site.
    • Database name:This is the core of achieving independent content.Each AnqiCMS site requires an independent database to store articles, products, categories, and other data. You can create a new database name, for example, using the same domain conversion form, such asdev_anqicms_comEnsure that the database name for each site is alsoUnique and non-repetitive.
    • Database information reuseIf all AnqiCMS sites in your Docker deployment use the same database server (for example, a MySQL container in Docker), you can choose to 'Reuse default database account information', and there is no need to re-enter the database connection credentials.
    • Select the template to use:Select 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, thereby achieving complete independence in page styles.

After completing the above configuration, click OK, a new, independent AnqiCMS site will be created and take effect. At this point, throughsite2.comvisiting, you will see a brand new, withsite1.comThe website content and configuration are completely independent sites.

The key to isolating templates and content.

By following the above steps, each site has achieved a high degree of isolation in both logic and data levels:

  • Content independence:Since each site is bound to a unique database name, all its articles, categories, single pages, tags, and other content are stored in their respective databases, without interference. When you insite1.comThe backend publishes articles, and it will only display onsite1.com.site2.comwill display its independent articles.
  • Configure independentlyIn AnqiCMS backend 'Backend Settings', such as 'Global Function Settings', 'Contact Information Settings', 'Home Page TDK Settings', etc., all modifications for a specific site will only affect that site and will not affect other sites.
  • Template Independent: The template selected when each site is created will determine its frontend display style. You can design completely different templates for each site, or