How to implement multi-site deployment of AnQiCMS through reverse proxy in Docker on Baota panel?
AnQiCMS (AnQiCMS) with its powerful multi-site management capabilities, provides great convenience for operators.In the Docker environment of Baota panel, the multi-site deployment of AnQiCMS through reverse proxy can not only effectively isolate the running environment of different sites, but also make full use of the built-in multi-site function of AnQiCMS, thereby realizing efficient content management and resource integration.As an experienced website operator specializing in Anqi CMS, I will elaborate on this deployment process to help you easily manage multi-site operations.
Preparation and Core Service Deployment
Before starting the multi-site deployment, you need to make sure that the Baota panel is correctly installed and that the Docker service is running normally.The core service of AnQi CMS is usually deployed through a Docker container.This means you just need to run a Docker container instance of AnQiCMS to create and manage multiple independent websites in its powerful backend management system.
First, refer to the installation guide for AnQiCMS in the Baota panel Docker environment, and successfully deploy the first AnQiCMS instance.During this process, you need to install Docker version of MySQL and note down its root password, as the database configuration of the subsequent new site will reuse this information.When the AnQiCMS container starts and binds to the local port (usually 8001), use the Baota panel's reverse proxy to point your main domain to the container service.After completing this step, your first AnQiCMS website will be able to access normally and will have an initial administrator account and password.
Add Reverse Proxy Site on Baota Panel
When your AnQiCMS core service runs in Docker and listens on an internal port (such as127.0.0.1:8001When it is necessary to bind a domain to a new site and point it to the AnQiCMS service, it is necessary to use the reverse proxy function of the Baota panel.
First, log in to your Baota panel. In the left navigation bar, select the "Website" menu, and then switch to the "Reverse Proxy" tab.Click the "Add Reverse Proxy" button to start configuring the domain for the new site.In the pop-up configuration interface, you need to make the following settings:
Enter your new site's domain name in the “Domain” field, for exampledev.anqicms.com. This domain must have been resolved to your server's IP address.
The 'Target URL' points to the internal address and port that your AnQiCMS Docker container is listening on. Typically, this should be filled in here.https://en.anqicms.comIf your AnQiCMS Docker container is listening on a different port, please adjust it according to the actual situation.
After confirming that the configuration is correct, click the "Submit" button. The Baota panel will automatically create and configure the reverse proxy rules for the domain name for you, so that external requests can be forwarded to your AnQiCMS service.
Configure a new site on the AnQi CMS backend
After the reverse proxy configuration is complete, you need to go to the AnQiCMS backend management interface to formally create and configure a new site.AnQiCMS has a complete multi-site management feature, allowing you to manage all sites from a single backend.
Log in to the AnQiCMS backend of your main site, navigate to the 'Multi-site Management' function area.Click the "Add New Site" button to start configuring a new site.In this interface, you need to fill in the information carefully:
The "site name" can be named according to your actual needs, which helps you distinguish different sites on the backend.
The 'site root directory' is a critical setting, used to independently store new site cache, static files, and other data to ensure data isolation between different sites. Since AnQiCMS runs in a Docker container, the file system path is unified from/app/Start. Therefore, it is recommended that you follow/app/Name it by replacing the dot in the domain name with an underscore, for example, if the new site domain isdev.anqicms.comthen the site root directory can be set to/app/dev_anqicms_comMake sure that the root directory name for each site is unique.
“Website address”enter the complete URL of the new site, for examplehttp://dev.anqicms.com.
Set an independent “admin account password” for the new site, which will be your credential for future login to the site backend.
The database name also needs to specify a unique database for the new site. To maintain consistency and facilitate identification, you can continue to use the method of replacing the dot in the domain name with an underscore, for exampledev_anqicms_com.
In the "Database Information Reuse" option, since your AnQiCMS is deployed using Docker and usually only one MySQL instance serves all sites, choosing "Reuse Default Database Account Information" will be the most convenient way.AnQiCMS will use the MySQL root account and password you configured during Docker installation to create a database for the new site.
Finally, select a template suitable for the new site, then click the "OK" button to complete the creation of the new site.AnQiCMS will automatically initialize all the necessary data tables and basic configurations for a new site in the newly created database.
Access and verify the new site
After completing the reverse proxy configuration of the Baota panel and the creation of the new site in the AnQiCMS backend, your new site has been successfully deployed.
You can enter the domain name of the new site in the browser, for examplehttp://dev.anqicms.com/Visit the new site's frontend page and perform the initial installation (if AnQiCMS does not automatically jump to the installation interface).In most cases, AnQiCMS will recognize new domain names and guide you through the initial setup.
To access the backend management interface of the new site, just add it to the domain name of the new site/system/Path, for examplehttp://dev.anqicms.com/system/. Log in with the administrator account and password you set up on the new site to start managing the content of the new site.
In this way, you successfully used reverse proxy and the built-in multi-site feature of AnQiCMS in a Docker container instance to achieve independent deployment and centralized management of multiple sites.This greatly simplifies operation and maintenance work, improving the efficiency of multi-site operation.
Frequently Asked Questions (FAQ)
1. Why do I only need to deploy one AnQiCMS Docker container instance to achieve multi-site management instead of deploying a container for each site?
This is because AnQiCMS considered the need for multi-site management from the very beginning.It comes with a site management module that allows the creation and management of multiple logically independent sites within the same AnQiCMS application instance.Each site has its own database, file directory (used for caching, uploading, etc.), templates, and configurations.The Docker container provides a unified runtime environment here, while the AnQiCMS application itself is responsible for the internal multi-site routing and data isolation.This model has lower resource usage and is also more centralized and efficient in management.
What is the significance of specifying the 'site root directory' and 'database name' when creating a new site in the AnQiCMS backend?
The root directory of the site is designed to provide each new site with an independent file storage space for storing their respective caches, attachments, logs, and other files. In the Docker environment, this directory needs to start with a path accessible within the container, for example/app/In order to avoid file path conflicts between different sites, it is recommended to use domain names for naming (such asdev_anqicms_com)
The database name is to create an independent database instance for a new site, ensuring that the data of each site does not interfere with each other. Similarly, use the domain name as part of the database name (such asdev_anqicms_comIt helps to clearly identify and manage each site's data at the database level.Due to the Docker installation of AnQiCMS usually sharing a MySQL service, simply select 'Reuse default database account information' when creating a new site, AnQiCMS will use the configured permissions to create a new database.
3. How to troubleshoot when accessing the new site after deployment and encountering "502 Bad Gateway" or "404 Not Found" errors?
If a "502 Bad Gateway" error occurs, it usually means that the Baota reverse proxy failed to successfully connect to the AnQiCMS Docker container service. You need to check:
- Is the AnQiCMS Docker container running normally? (Check in the Baota Docker management interface)
- Is the target URL of Baota reverse proxy correctly pointing to the internal IP and port of the AnQiCMS container (such as
https://en.anqicms.com)? - Does the server firewall or security group block access to the internal port?
If a "404 Not Found" error occurs, this usually indicates that the reverse proxy has successfully forwarded the request, but the AnQiCMS application internally could not find the corresponding site or page. You need to check:
- Have you successfully added the site in the "Multi-site Management" of the AnQiCMS backend?
- Does the "Website Address" in the site configuration match the domain name you are visiting exactly (including
http/https)? - Does the new site need to be initially installed? Try to access
http://your-new-domain.com/system/Check if you can enter the backend login or installation interface. - Are the static rules configured correctly? Although most of the reverse proxy has been handled, the URL rewriting within AnQiCMS also depends on its own static rules configuration.