What is the configuration example of setting up Nginx pseudo-static rules for AnQiCMS multi-site on Baota panel?

Calendar 👁️ 69

As an experienced CMS website operation person in an enterprise, I am well aware of the importance of content creation, editing, publishing, and optimization, and also know how to attract and retain users through high-quality content.The multi-site management function of AnQi CMS is one of its core highlights, providing great convenience for users who need to manage multiple brands or sub-sites.It is crucial to fully utilize this feature and correctly configure the Nginx pseudo-static rules.

The detailed explanation of setting up Nginx pseudo-static rules for multiple sites on the Baota panel for AnQi CMS.

Understanding the multi-site mechanism of AnQi CMS.

The Anqi CMS is developed using Go language, its multi-site management feature allows users to manage multiple independent websites under the same system and the same running instance. The system identifies the information passed through Nginx.HostThe request header determines which site the user is visiting and provides the corresponding content based on the configuration of the site.This means that regardless of how many child sites you have, the security CMS application running in the background typically has only one instance, while Nginx plays a crucial role in request distribution and URL rewriting.

Preparation work

Before configuring the Nginx pseudo-static rules, please make sure you have completed the following preparations:

You have successfully installed the first site (main site) of AnQi CMS on the Baota panel, whether through Docker deployment or manual deployment. The main site usually runs on a port inside the server, such as the default port.8001. You have parsed the domain for the main site and can access and manage it in the browser.You have the domain name for the new sub-site that needs to be added, and these domains have been correctly resolved to your server IP address.

Create a new site and configure Nginx rewrite rules on the Baota panel

To add a new child site for AnQi CMS, it is actually to create a reverse proxy configuration for a new domain name on the Baota panel and point it to the internal port where the AnQi CMS application is running.

First, please log in to your Baota panel. In the left navigation bar, select 'Website' and then click 'Add Site' or 'Add Reverse Proxy'.

For the multi-site setup of AnQi CMS, we usually choose the "reverse proxy" type to create a new site because all requests will eventually be forwarded to the Go application instance of AnQi CMS.

Fill in the relevant information for the new site in the pop-up interface:

Domain:Enter the complete domain name of your new sub-site, for examplenewsite.yourdomain.com.Proxy name:You can fill in according to your needs, for example, "AnQi CMS Substation 1".Target URL:Please fill in the actual internal address and port of your AnQi CMS main application, which is usuallyhttps://en.anqicms.comPlease adjust the configuration of your main site according to actual settings, ensuring that the port number is correct.

After completing the above entries, click 'Submit' to create the site.

After the site is created, you need to adjust the rewrite rules of the Nginx configuration for the site.Find the new site you just created in the "Website" list, click the "Settings" button on the right.

After entering the site settings, switch to the "Static" tab. Clear the existing content and paste the following Nginx static rules:

    location @AnqiCMS {
        proxy_pass https://en.anqicms.com; # 请确保这里指向您的AnQiCMS应用实际运行的内部地址和端口
        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;
    }

Please note,proxy_passIn the command of thehttps://en.anqicms.comReplace with the actual internal IP address and port that your Anqicms application is listening on. The purpose of these rules is:

  • location @AnqiCMSIt defines an internally named location block used to handle rewritten or missing static file requests. It forwards the request to the Anqic CMS application and passes the necessary request header information (Host/X-Real-IP/X-Forwarded-ForThis is crucial for the Anq CMS to identify which site the request is from.
  • error_page 404 =200 @AnqiCMS;When Nginx cannot find any matching static files, it will handle the 404 error as a 200 status code and forward the request to@AnqiCMSProcess, ensure that all non-static content can be processed by the Aiqi CMS application.
  • location /This is the default block that Nginx processes all requests.try_files $uri $uri/index.html @AnqiCMS;The command attempts to find files in order: first the requested URI ($uri), then the correspondingindex.htmlfile. If these files do not exist, it will forward the request to the one previously defined@AnqiCMSThe block is finally processed by the AnQi CMS application. In this way, Nginx will first try to provide static files, and if it cannot find static files, it will forward the request to AnQiCMS to handle dynamic content.

After pasting the pseudo-static rules, be sure to click "Save" to apply the changes.

Moreover, due to the characteristics of the Baota panel, even reverse proxy sites may need to configure a "website directory". You can set the "website directory" of the new site to the directory where the Anqi CMS main site is located.publicsuch as/www/wwwroot/anqicms.com/public. This is to ensure that Nginx is runningtry_filesThe command attempts to find static files and is able to locate the public static resources provided by the Anqin CMS application (such as CSS, JS, images, etc.).

Add a new site configuration in AnQi CMS backend

After completing the Nginx configuration, you still need to add and configure this new site in the AnQi CMS backend management system.

Log in to the backend management interface of your Anqin CMS main site. Find the 'Multi-site Management' feature in the left navigation bar and click 'Add New Site'.

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

  • Site Name:Fill in according to your actual needs, used for background management and identification.
  • Site root directory:This is a very important field, it determines the independent data storage location of the new site. Since AnQi CMS may run in a Docker environment, this path is usually set to/app/Starting. For example, if your new domain name isnewsite.yourdomain.comyou can fill in/app/newsite_yourdomain_com(including the domain name within).Replace_To avoid directory name conflicts). Make sure to set a unique root directory for each new site, and the directory name does not conflict with other sites.
  • Website address:Enter the full access URL of your new sub-site, for examplehttp://newsite.yourdomain.com.
  • Admin account password:Set up an independent backend admin account and password for the new site.
  • Database name:Create an independent database for the new site. It is recommended to name it in domain format, for examplenewsite_yourdomain_com.
  • Database information reuse: If your AnQi CMS is installed with Docker and the MySQL database is also in Docker, you can choose to 'Reuse default database account information' because AnQi CMS in the Docker environment usually has all the database management permissions.If you deploy the database elsewhere, you need to fill in the database connection information truthfully.
  • Select the template to use:Choose a suitable template for the new site.

Click the “OK” button to complete the creation of the new site after filling in.

Verify the new site

Your CMS multi-site configuration is now complete. Now, you can enter the domain name of the new sub-site in your browser (for examplehttp://newsite.yourdomain.com/Access it. If everything is configured correctly, you will see the homepage of the new site. You can also access it byhttp://newsite.yourdomain.com/system/Visit the background management interface of the new site and log in using the administrator account and password you set in the Anqi CMS background.

Frequently Asked Questions (FAQ)

1. How does AnQi CMS differentiate and display content for different sites under the same running instance?

AnQi CMS passes through Nginx reverse proxy.HostThe request header identifies different sites. When the user visitsnewsite.yourdomain.comNginx will forward the request to the Anqi CMS application and include it in the request header.Host: newsite.yourdomain.com. The AnQi CMS application will parse thisHostThe header, according to the "Multi-site Management" configuration of the background "Site Address" to match the corresponding site, and load the database, template and other configuration information of the site, thus realizing the isolation and display of multi-site content.

2. Can I set up independent Nginx configurations for each sub-site, such as different SSL certificates or caching policies?

Yes, you can. When creating Nginx sites individually for each subdomain in the Baota panel, each site will have its own independent Nginx configuration file.This means you can configure SSL certificates separately for each site (in the 'SSL' tab of the Baota panel), set independent cache rules, or add specific Nginx

Related articles

How to quickly access the new multi-site backend through the AnQiCMS backend management list?

As an experienced CMS website operation personnel, I know the importance of managing multiple sites efficiently.The multi-site management function of Anqi CMS greatly simplifies the operation of enterprises with multiple brands or sub-sites.Below, I will introduce to you in detail how to quickly and conveniently access the multi-site background you have just created through the AnQiCMS backend management list.

2025-11-06

Can the database account information be reused when deploying AnQiCMS across multiple sites?

As an experienced CMS website operation personnel in the security industry, I fully understand that how to efficiently and safely configure resources when managing multiple sites is the core concern.About the question you raised 'Can the database account information of different sites be reused when deploying AnQiCMS across multiple sites?'This question, I can clearly tell you that in the AnQiCMS multi-site deployment, the database account information of different sites can be reused, but the database instance itself needs to be independent.

2025-11-06

Is each AnQiCMS instance required to use an independent database in multi-site mode?

As an experienced website operator familiar with AnQiCMS, I know the importance of the architecture selection of the content management system for the long-term operation of the website, especially when it comes to multi-site deployment, the configuration of the database is one of the key considerations.About whether each site must use an independent database in the multi-site mode of AnQiCMS, this is a key issue that many operators pay attention to at the beginning of planning.AnQiCMS was designed from the beginning to fully consider the user scenarios of small and medium-sized enterprises, self-media operators, and users with multi-site management needs.The 'Multi-site Management' core feature

2025-11-06

What are the specific requirements for the setting of the "site root directory" in the AnQiCMS multi-site configuration?

In AnQiCMS (AnQiCMS) multi-site management feature, "site root directory" is a crucial configuration item.It is not just a simple file path, but also the foundation to ensure that each sub-site operates independently and efficiently.As an experienced website operator, I am well aware of the importance of correctly configuring this parameter for multi-site stability and data isolation.The main function of the "site root directory" is to provide a dedicated data storage space for each independent AnQiCMS site.This means the cache files, uploaded resources for each sub-site

2025-11-06

How to implement independent cache data management for different sites in AnQi CMS multi-site function?

As a senior security CMS website operation personnel, I am well aware of the challenges faced by content management systems in multi-site operations, especially in ensuring the independence and performance optimization of data for each site.The multi-site function of Anqi CMS was well thought out from the beginning, especially in terms of independent cache data management, providing a clear and efficient solution.

2025-11-06

What is the Docker image name for deploying AnQiCMS Docker version using 1Panel?

In the daily operation of AnQi CMS, we fully understand that the ease of deployment is crucial for efficiency.With the increasing popularity of containerization technology, deploying the Docker version of AnQiCMS with a visual management tool like 1Panel has become the preferred choice for many teams.For operators who are new to the field or wish to standardize the deployment process, specifying the name of the Docker image used is a critical step for successful deployment.AnQiCMS as an enterprise-level content management system based on Go language, with its high efficiency

2025-11-06

How to configure reverse proxy for the AnQiCMS Docker container deployed in Panel environment?

In the wave of digital operation, a high-efficiency content management system (CMS) like AnQiCMS, combined with modern deployment methods such as Docker, brings great convenience to website operation.However, the configuration of reverse proxy is indispensable for these containerized applications to provide stable and professional services.

2025-11-06

How is the one-click deployment process for installing AnQiCMS Docker on aaPanel (BaoTa International Edition)?

As a professional deeply familiar with the operation of Anqi CMS, I know that a smooth and efficient deployment process is crucial for improving operational efficiency.AnQi CMS, developed in Go language, offers high performance, high security, and excellent SEO-friendliness, making it an ideal choice for many small and medium-sized enterprises and content operation teams.While using the Docker container technology of aaPanel (Baota International Edition), we can achieve the quick one-click deployment of secure CMS, greatly simplifying the complex environment configuration process.

2025-11-06