As a website operator who is deeply familiar with the operation of AnQiCMS, I fully understand the challenges you encounter in multi-site management, and I know that efficient and stable configuration is crucial for business expansion.To configure reverse proxy for AnQiCMS multi-site on Baota panel is a common 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 management and maintenance work.

This guide will explain in detail how to set up reverse proxy for AnQiCMS multi-site on the Baota panel.

Understand the AnQiCMS multi-site and reverse proxy mechanism.

AnQiCMS is a system developed based on the Go language, one of its core advantages is good support for multiple sites.This means you do not need to deploy an AnQiCMS program separately for each site, but can manage multiple independent website contents through a centralized AnQiCMS application,配合 different domain names.

On the Baota panel, when you deploy AnQiCMS through Docker, the application will usually listen on an internal port (for example, the default is8001The role of reverse proxy is to forward the requests of external users who access the website through the domain name to this 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 internally will identify which site is requested based on the domain name and provide the corresponding service.

Prerequisites

Before starting the configuration, please make sure that your server is installed with 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 Baota Panel

First, we need to create a reverse proxy site for your new domain in the Baota panel.This operation will tell Nginx (or Apache) how to handle requests sent to the domain name.

Log in to the Baota panel, navigate to the "Website" option in the left menu. In the "Website" interface, select the "Reverse Proxy" tab and then click the "Add Reverse Proxy" button.

In the pop-up window for adding reverse proxy configuration, you need to fill in the following information:

Primary domain: Enter the domain name of your new site, for examplenewsite.com. Agent name: It is usually filled in automatically, you can also customize it as needed, such asnewsite.com_proxy. Target URL: Enter the internal address and port that the AnQiCMS Docker application is listening on, which is usuallyhttp://127.0.0.1:8001. If you have changed the port of AnQiCMS during Docker deployment, please enter the actual port number you are using.

After confirming that the information is correct, click the "OK" button to complete the creation of the reverse proxy site.

Configure the website directory and pseudo-static 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 runtime directory and rewrite rules, to ensure that Nginx can correctly process requests and forward them to AnQiCMS.

On the "Website" page of the Baota panel, find the domain corresponding to the new site you just created, click the "Settings" link in the operation bar.

After entering the website settings page, first switch to the "Website Directory" tab. Set the website's "runtime directory" to/publicAfter that, click Save. This step ensures that Nginx can find the static resource path that AnQiCMS may need when receiving a request.

Next, switch to the "pseudo-static" tab. Since the AnQiCMS Go application 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.Please paste the following Nginx configuration in the pseudo-static rule text box:

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 indicates that the pseudo-static rules should be left blank and the target URL should be filled in directly in the reverse proxy settingshttp://127.0.0.1:8001.

Add a new site in AnQiCMS backend

After completing the reverse proxy and Nginx configuration of the Baota panel, the final step is to create and configure a new site within your AnQiCMS application.

Log in to the admin interface of your main AnQiCMS site. Navigate to the "Multi-site Management" feature in the left menu, then click the "Add New Site" button.

In the form for adding a new site, you need to fill in the following information in detail:

Site Name: Fill in according to your actual needs, used to distinguish different sites in the AnQiCMS backend. Site root directory: This is a very important setting used to isolate data for different sites (such as cache, uploaded files, etc.). Please use/app/Starting, and using 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. Admin account password: Set a separate admin account and password for the new site.Database name: To ensure data isolation, please specify a unique database name for the new site, such asdev_anqicms_com. Database information reuse: Since AnQiCMS is deployed with Docker and has full database management permissions, you can usually choose to 'reuse the default database account information'.If you have special requirements to connect to an external database, you need to fill in the connection information truthfully. Choose a template: Select an appropriate template for the new site.

After filling in all the information, click the “OK” button to complete the creation of the new site.

Verify the new site

Up to now, your AnQiCMS multi-site reverse proxy configuration is complete. You can now enter the new site domain name (such ashttp://newsite.com/) for access.

To access the back-end management interface of the new site, please enter in the browser您的新域名/system/For examplehttp://newsite.com/system/. You can also jump directly to the management interface of the new site through the 'Visit Admin' button in the 'Multi-site Management' list of the AnQiCMS main background.

By following these steps, you can efficiently manage multiple independently operated websites on an AnQiCMS Docker instance.


Frequently Asked Questions (FAQ)

1. Do I need to install an independent AnQiCMS Docker container for each AnQiCMS site?Not required. AnQiCMS multi-site management feature 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 in the Baota panel?http://127.0.0.1:8001? 127.0.0.1It points to the server itself.8001Is the AnQiCMS Docker container internal service port exposed.This means that Nginx or Apache on the Baota panel will forward external domain name requests to the AnQiCMS Docker service running locally on the server, thereby realizing the connection and data exchange between internal and external networks.

How do I access the admin interface of the AnQiCMS site I just added?The admin access address of the newly added site is the domain name plus/system/path. For example, if your new site domain isdev.anqicms.com, then the backend access address ishttp://dev.anqicms.com/system/In addition, you can also log in to the main AnQiCMS instance backend, go to the "Multi-site Management" list, find the corresponding site, click the "Access Backend" button to directly jump to it.