As an experienced CMS website operator, I am well aware of the importance of an efficient and flexible content management system for enterprises and self-media in the increasingly complex network environment.AnQi CMS, with its high-performance architecture based on the Go language, rich feature set, and SEO-friendliness, has become the ideal choice for many users.Especially in multi-site management, AnQiCMS provides a simple and efficient solution.

Today, I will delve into how to deploy multiple sites of AnQi CMS in a Docker environment and configure reverse proxy, which not only enhances the convenience of deployment but also provides strong support for your multi-site operation.

Embrace Docker, build an efficient and stable secure CMS multi-site environment

AnQi CMS is positioned to serve small and medium-sized enterprises and content operation teams, one of its core advantages is the powerful multi-site management capability, which can allow you to manage multiple brands, sub-sites, or content branches uniformly, greatly reducing repetitive work.When we combine this advantage with Docker containerization technology, deployment and management will become unprecedentedly efficient and flexible.Docker provides a lightweight, portable, and self-contained runtime environment, ensuring that CMS can run consistently anywhere and simplifying dependency management and environment configuration.For users who need to operate multiple sites, Docker's isolation, scalability, and ease of maintenance are undoubtedly the key to building a stable and high-performance website cluster.

Deploy the first secure CMS site container

The first step to deploy AnQi CMS in Docker environment is to establish a basic containerized runtime environment and configure reverse proxy for your main site.Here, we will take mainstream panel tools as examples, such as 1Panel or Baota panel, which integrate Docker management functions and greatly simplify the operation process.

First, make sure that Docker is installed on your server, and to store QiCMS data, you also need to install a MySQL database service through the panel app store.If installed via 1Panel, please select OpenResty as the reverse proxy server in the app store.

Next, we need to create a container for the Safe CMS in Docker. In the container management interface of the panel, select Create Container. Name the container, for exampleanqicms-main. Manually enter in the mirror selectionanqicms/anqicms:latestto obtain the latest stable version of the AnQi CMS mirror. The key step is port configuration: set the container's internal port to8001And expose it to an available port on the server, for example, the same is8001This port is the only interface for the Anqi CMS application to provide external services. After the container is created, set an appropriate restart strategy to ensure high availability of the service.

After the container is successfully started, the next step is to configure the reverse proxy to forward external domain requests to the AnQiCMS container.In the panel's website management feature, create a new reverse proxy site.Enter your primary domain name, for exampleyourmaindomain.comSet the proxy address to the local IP and port of the Docker container, usually127.0.0.1:8001The reverse proxy not only implements port mapping, but also allows you to access multiple sites through different domain names on the same server, and can handle advanced features such as SSL certificates, traffic distribution, etc.After the configuration is complete, visit your main domain name, follow the AnQiCMS guide to complete the initial installation, including database connection and administrator account settings.

Expand multi-site management: The powerful charm of Anqi CMS

The strength of AnQi CMS lies in its built-in multi-site management feature, which means you do not need to deploy an AnQi CMS container separately for each site.A AnQiCMS Docker container is enough to manage hundreds or even thousands of independent sites.This design concept greatly saves server resources and simplifies the complexity of operations and maintenance, perfectly fitting the project positioning of AnQiCMS 'uniformly manage different content sites'.

To add a new site to an existing AnQi CMS instance, first log in to the backend of the AnQiCMS main site you have installed.Find the "Multi-site Management" feature in the left navigation menu and click "Add New Site".Here, you need to configure several key information for the new site:

  • Site name: Used for distinguishing friendly names in the background.
  • Site root directory: This is the independent storage path for the new site data. Because AnQiCMS runs in a Docker container./app/Under the directory, therefore it should start with/app/and use the domain name (dots replaced with underscores) as the subdirectory name, for example/app/dev_anqicms_comEnsure that each site's directory name is unique to avoid data conflicts.
  • website address: The full domain name of the new site, for examplehttp://dev.anqicms.com.
  • Administrator account password: Set up an independent backend management account for the new site.
  • Database name: Specify a unique database name for the new site, it is also recommended to use the domain name (dots replaced with underscores) as a prefix, for exampledev_anqicms_com. An QiCMS supports reusing the Docker MySQL account information, no additional database credentials need to be configured.
  • Select the template to use: Choose an appropriate template based on your design requirements.

After completing these configurations and clicking confirm, AnQiCMS will create all necessary data structures and configuration files for the new site within its internal system.

Configure reverse proxy for the newly added site

After adding a new site in the AnQiCMS background, although AnQiCMS has already 'recognized' this new site, external users still cannot access it.You need to configure a separate domain and reverse proxy rules for each new site on the server panel.

Go back to your server management panel (such as 1Panel or Baota panel) website management interface, click on "Create website" or "Add reverse proxy" again. Enter the domain name of the new site, for exampledev.anqicms.comPlease note that the proxy address of this new site must still point to the exposed port of your unique AnQiCMS Docker container, i.e.127.0.0.1:8001This is because AnQiCMS internally uses theHostHeader information (i.e., the domain name accessed by the user) to determine which site the request belongs to and to provide the corresponding content.Each reverse proxy will forward requests for specific domain names to the same AnQiCMS container, and the container will then identify the corresponding AnQiCMS sub-site based on the domain name.

Repeat the above steps to configure reverse proxy for each of your new sites.Once configured, you can access each independent AnQiCMS sub-site through its corresponding domain.In the "Multi-site Management" list of the AnQiCMS backend, you can conveniently click the "Access Backend" button to directly jump to the management interface of the corresponding site.

key configuration and **practice

When deploying Anqi CMS multi-site and configuring reverse proxy, there are several**practices worth your attention, which will directly affect the performance, security, and maintainability of your website:

  • Domain resolution: Make sure that all domain names of the sites are correctly resolved to your server IP address before configuring the reverse proxy. This is the foundation for all external access.
  • Resource planning: Even a Docker container can host multiple AnQiCMS sites, but you also need to reasonably plan the server's CPU, memory, and storage resources based on your expected traffic and number of sites.The high concurrency features of the Go language make AnQiCMS excellent in resource utilization, but too many high-traffic sites may still put pressure on the server.
  • Database isolation: Although multiple AnQiCMS sites can share a single MySQL database service, it is strongly recommended to configure an independent database instance for each site.This can effectively isolate data from different sites, prevent cross-contamination, and facilitate future data backup, recovery, and migration.
  • Enhanced Security: AnQiCMS provides a custom backend domain feature, you can set an independent access address for the backend of each site to enhance security.At the same time, be sure to use a complex and unique administrator password and update it regularly.
  • SEO optimization: AQiCMS built-in powerful SEO tools, such as pseudo-static, 301 redirection, Sitemap generation, Robots.txt configuration, keyword library management, etc.In a multi-site environment, make sure to configure and optimize these SEO settings independently for each site to maximize the search engine visibility of each site.

By deploying your applications in Docker containers and leveraging the powerful multi-site management features of AnQi CMS, you will be able to operate your website cluster with high efficiency and flexibility, whether it is for content marketing of small and medium-sized enterprises or content distribution of self-media, you will be at ease.

Frequently Asked Questions

Q1: I deployed AnQiCMS in a Docker container and created multiple sub-sites.Why is it always redirected to the main site's admin interface when accessing the backend of one of the child sites?

A1:This is usually due to your reverse proxy configuration not passing through correctlyHostheader information. AnQiCMS detects the information in the request.HostThe field is used to identify which sub-site the user is visiting. Please check your reverse proxy configuration (such as Nginx or OpenResty) to ensure it includesproxy_set_header Host $host;This command. If you are using the panel tool, please confirm that its reverse proxy module is correctly handling this information.

Q2: Can I configure an independent Docker container for each AnQiCMS sub-site?

A2:Although technically feasible, this goes against the design philosophy of the multi-site management built into AnQiCMS and will increase unnecessary resource consumption and management complexity.The multi-site function of AnQiCMS is designed to allow you to manage all sites in a single running instance.Deploying containers individually for each child site will disable the multi-site management feature, you will not be able to manage all sites uniformly in the background of the main site, and it will also consume more CPU, memory, and storage resources.It is recommended that you follow the instructions introduced in the document, and add and manage sub-sites through the multi-site management function of the background of an AnQiCMS container.

Q3: How to ensure that my AnQiCMS multi-site achieves data isolation and high availability in the Docker environment?

A3:For data isolation, when adding a new site in the AnQiCMS background, please configure an independent database name and site root directory for each site.Even though they share the same MySQL Docker container and AnQiCMS Docker container, the data is independent from each other.Regarding high availability, Docker itself provides the container automatic restart function, you can configurerestart: alwaysorrestart: on-failureStrategy. At the same time, you can consider mounting the MySQL database's data directory to the host volume to ensure data persistence and facilitate backup.For more advanced scenarios, you can explore Docker Compose for service orchestration, or use container orchestration tools like Kubernetes to manage and scale your AnQiCMS cluster.