As a website operator who is deeply familiar with the operation of AnQiCMS, I fully understand the challenges you may encounter in multi-site management and am well aware of the importance of efficient and stable configurations for business expansion.To configure reverse proxy for AnQiCMS multi-site on the Baota panel is a commonly used and effective method to achieve this goal.This allows you to provide content services for multiple different domain names through a single AnQiCMS application instance, greatly simplifying the management and maintenance work.
This guide will detail how to set up reverse proxy for AnQiCMS multi-site on Baota panel.
Understand the AnQiCMS multi-site and reverse proxy mechanism
AnQiCMS as a system developed based on the Go language, one of its core advantages is good support for multi-sites.This means you do not need to deploy a separate AnQiCMS program for each site, but can manage the content of multiple independent websites through a centralized AnQiCMS application, with different domain names.
On the Baota panel, when you deploy AnQiCMS via Docker, the application usually listens on an internal port (for example, the default is8001)。The role of reverse proxy is to forward the requests made by external users accessing the website through the domain name to the internal listening port of the AnQiCMS application.For multi-site configuration, each new domain name will be directed to the same AnQiCMS application port through its own reverse proxy rules, but AnQiCMS will identify which site the request is for internally and provide the corresponding service.
Prerequisites
Before starting the configuration, please ensure that your server has installed Baota Panel, and the AnQiCMS application has been successfully deployed and running via Docker, for example, listening on8001Port. At the same time, all the domain names you plan to use for the new site have been correctly resolved to your server IP address.
Add a reverse proxy site in the Baota panel.
Firstly, we need to create a reverse proxy site for your new domain name in the Baota panel.This operation will tell Nginx (or Apache) how to handle requests to this domain.
Log in to the Baota panel, navigate to the "Website" option on the left menu. In the "Website
In the pop-up Add Reverse Proxy Configuration window, you need to fill in the following information:
Primary domain: Enter the domain name of your new site, for examplenewsite.com。
Proxy name: It will be filled in automatically, or you can customize it as needed,newsite.com_proxy。
目标URL:这里填写AnQiCMS Docker应用监听的内部地址和端口,通常是Englishhttp://127.0.0.1:8001. If you modify the port of AnQiCMS when deploying Docker, please fill in the actual port number you are using.
Confirm the information is correct and then click the "OK" button to complete the creation of the reverse proxy site.
Configure the website directory and rewrite rules for the new site.
Although AnQiCMS provides services through reverse proxy, Baota panel still needs to configure a website record for each domain, set the correct running directory and rewrite rules, to ensure that Nginx can correctly handle requests and forward them to AnQiCMS.
In the "Websites
After entering the website settings page, first switch to the "Website Directory" tab. Set the website's "Running Directory" to/publicThen click Save. This step ensures that Nginx can find the static resource path that AnQiCMS may need when receiving requests.
Next, switch to the "Static" tab.Since the Go application of AnQiCMS needs to handle all routes, we need to configure Nginx to forward all requests that do not match static files to the AnQiCMS proxy address.
location @AnqiCMS {
proxy_pass http://127.0.0.1:8001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 404 =200 @AnqiCMS;
location / {
try_files $uri $uri/index.html @AnqiCMS;
}
After pasting, click "Save". If you are using Apache, the document states that the pseudo-static rules should be left blank and the target URL should be filled directly in the reverse proxy settings.http://127.0.0.1:8001.
Add a new site in AnQiCMS background
After completing the reverse proxy and Nginx configuration for Baota panel, the final step is to create and configure a new site within your AnQiCMS application.
Log in to the backend management interface of your main AnQiCMS site. Navigate to the "Multi-site Management
In the form for adding a new site, you need to fill in the following information in detail:
站点名称:根据您的实际需求填写,用于在AnQiCMS后台区分不同的站点。
Site root directory: This is a very important setting used to isolate data for different sites (such as cache, uploaded files, etc.)./app/Start with, and use the domain name with underscores instead of dots as the directory name, for example/app/dev_anqicms_comEnsure that the directory name for each site is unique to avoid data conflicts.
Website address: Enter the full URL of your new site, for examplehttp://dev.anqicms.com.
Administrator account and password: Set an independent backend management account and password for the new site.dev_anqicms_com.Database information reuse: As AnQiCMS is deployed using Docker and has full database management permissions, you usually can choose to "Reuse default database account information".If you have special requirements to connect to an external database, you need to fill in the connection information truthfully.
Select the template to use: Choose a suitable template for the new site.
Fill in all the information and click the "Confirm" button to complete the creation of the new site.
Verify the new site
Here, your AnQiCMS multi-site reverse proxy configuration is completely finished. You can now enter the new site's domain name in the browser (for examplehttp://newsite.com/) to visit.
To access the back-end management interface of the new site, please enter it in the browser您的新域名/system/for examplehttp://newsite.com/system/。You can also directly jump to the management interface of the new site by clicking the "Visit Backend" button in the "Multi-Site Management" list of the AnQiCMS main backend.
Manage multiple independently operated websites efficiently on an AnQiCMS Docker instance with these steps.
Common Questions and Answers (FAQ)
1. Do I need to install an independent AnQiCMS Docker container for each AnQiCMS site?No need.The multi-site management feature of AnQiCMS allows you to manage and run multiple independent sites through a single AnQiCMS Docker container instance.All newly added sites will share the same AnQiCMS application process, but their content, configuration, and some data (such as cache, database tables) are independent.
2. Why is the target address usually a loopback address when configuring reverse proxy on the Baota panel?http://127.0.0.1:8001?
127.0.0.1It points to the server itself.8001Is the service port exposed inside the AnQiCMS Docker container.This means that the Nginx or Apache on the Baota panel will forward external domain requests to the local AnQiCMS Docker service running on the server, thereby achieving the connection and data exchange between the internal and external networks.
How do I access the back-end management interface of the newly added AnQiCMS site?The back-end access address of the newly added site is the domain name it is bound to plus/system/Path. For example, if your new site domain isdev.anqicms.com, then the backend access address ishttp://dev.anqicms.com/system/