What is the configuration method for Apache reverse proxy for AnQiCMS multi-site?

Calendar 👁️ 56

As a website manager who deeply understands the operation of AnQiCMS, I fully understand the importance of efficient and scalable content management for enterprises, especially when facing the needs of multi-site operations.AnQiCMS with its powerful multi-site management function allows users to manage multiple brands or content branches under a single system architecture, greatly enhancing operational efficiency.However, to fully utilize this advantage, it is often necessary to rely on reverse proxy technology at the server level, where Apache is the preferred solution for many users.

This article will elaborate on how to configure Apache as a reverse proxy to achieve stable and efficient operation of AnQiCMS multi-sites.

Apache Reverse Proxy AnQiCMS Multi-site Configuration Method

AnQiCMS (AnQiCMS) is a content management system designed specifically for small and medium-sized enterprises and content operation teams, one of its core highlights being native support for multiple sites.This means that users can create and manage multiple independent websites within an AnQiCMS application instance, each with its own domain, content, and settings.In order to correctly route these different domain requests to the AnQiCMS application instance, and for AnQiCMS to identify and respond to the corresponding site content based on the received domain, we usually need to configure a reverse proxy.Apache is an ideal choice as a widely used web server to achieve this goal.

AnQiCMS Multi-site Management Mechanism Overview

The multi-site feature of AnQiCMS allows you to host multiple independent websites in a single AnQiCMS deployment.When a user accesses a website through its domain, the HTTP request first reaches the web server (such as Apache).The web server forwards the request to the AnQiCMS application running in the background via reverse proxy.AnQiCMS application receives a request and then parses the request headers ofHostField, based on this domain information, determine which specific site the user is visiting, and load the corresponding website data and template for rendering.This mechanism greatly simplifies the complexity of multi-site deployment and maintenance, avoiding the need to deploy a separate AnQiCMS application instance for each site.

The basic principle of Apache reverse proxy

The reverse proxy server is located between the user and the actual web application server.When the user initiates a request, the request is first sent to the reverse proxy server.Reverse proxy servers forward requests to one or more backend web application servers according to the configured rules (such as domain names) and return the responses from the application servers to the users.

For AnQiCMS multi-site scenarios, Apache acts as a reverse proxy, its main function is: It listens to HTTP/HTTPS requests for different domain names. It forwards all requests to the specific port that the AnQiCMS application is listening on (such as the default 8001 port).It ensures that the original domain information is retained when forwarding requests (i.e., HTTPHostHeader), so that AnQiCMS can correctly identify the target site.

Configuration steps in detail

Configure Apache reverse proxy for AnQiCMS multi-site primarily involves enabling necessary Apache modules, setting up Virtual Host for each site, and configuring core reverse proxy directives.

First, make sure that Apache Web Server is installed on your server and the AnQiCMS application instance is running on some port in the background (for example, by default on127.0.0.1:8001)

Enable Apache module

You need to enable Apache to perform reverse proxyingmod_proxyandmod_proxy_httpModule. It is usually completed by the following command in most Linux distributions:

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo systemctl restart apache2 # 或 sudo service apache2 restart

Create or modify Virtual Host configuration

Next, you need to create a separate Virtual Host configuration file for each domain managed by AnQiCMS, or modify the existing configuration file. These files are usually located/etc/apache2/sites-available/or/etc/httpd/conf.d/directory.

This is an example configuration applicable tosite1.comandsite2.comtwo domains, which will be served by the AnQiCMS instance running127.0.0.1:8001:

Withsite1.comCreate a configuration file (for examplesite1.com.conf):

<VirtualHost *:80>
    ServerName site1.com
    ServerAlias www.site1.com
    # 可选:设置日志路径
    ErrorLog ${APACHE_LOG_DIR}/site1.com_error.log
    CustomLog ${APACHE_LOG_DIR}/site1.com_access.log combined

    # 启用反向代理模块
    ProxyRequests Off
    # 保持原始Host头,AnQiCMS根据此头判断站点
    ProxyPreserveHost On

    # 将所有对site1.com的请求转发到AnQiCMS的8001端口
    ProxyPass / https://en.anqicms.com/
    ProxyPassReverse / https://en.anqicms.com/

    <Location />
        # 允许所有请求通过代理,可根据需求进行更精细的访问控制
        Require all granted
    </Location>
</VirtualHost>

Withsite2.comCreate a configuration file (for examplesite2.com.conf):

<VirtualHost *:80>
    ServerName site2.com
    ServerAlias www.site2.com
    ErrorLog ${APACHE_LOG_DIR}/site2.com_error.log
    CustomLog ${APACHE_LOG_DIR}/site2.com_access.log combined

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://172.0.0.1:8001/
    ProxyPassReverse / http://172.0.0.1:8001/

    <Location />
        Require all granted
    </Location>
</VirtualHost>

Please note,ProxyPass / https://en.anqicms.com/the command will route all incomingsite1.com(orsite2.comRedirect the request to127.0.0.1:8001.ProxyPassReverseEnsure that the redirect URL in the AnQiCMS response is correctly modified backsite1.com(orsite2.com)ProxyPreserveHost OnIt is crucial because it ensures the originalHostThe header is passed to AnQiCMS so that AnQiCMS can correctly handle multi-site logic.

If HTTPS support is required, a configuration must be made for each domain.VirtualHostListen on port 443 and add the corresponding SSL certificate configuration, for exampleSSLEngine On/SSLCertificateFileandSSLCertificateKeyFilecommand.

Activate Virtual Host and restart Apache

After configuration, you need to activate these Virtual Hosts and restart the Apache service to make the changes take effect.

sudo a2ensite site1.com.conf
sudo a2ensite site2.com.conf
sudo systemctl restart apache2 # 或 sudo service apache2 restart

AnQiCMS backend configure new site

After configuring reverse proxy in Apache, you still need to log in to the AnQiCMS backend management interface, add the corresponding site in the "Multi-site Management" function. This includes setting the site name, binding to the Apache Virtual Host inServerNameA consistent website address (for examplehttp://site1.com), and specify an independent site root directory and database name for the new site so that AnQiCMS can store and manage its content.

Important reminder and **practice

Domain resolution: Make sure that all involved domains (such assite1.com/www.site1.com/site2.cometc.) have their DNS records correctly pointing to your server IP address.

SSL/TLS configuration: It is strongly recommended to configure HTTPS for all sites. In Apache, you need to add in the relevantVirtualHostblock.SSLEngine On/SSLCertificateFileandSSLCertificateKeyFileInstruction, and ensure to listen for HTTPS requests on port 443.

Performance considerations: For high-traffic websites, reverse proxy can also be combined with load balancing technology to distribute requests to multiple AnQiCMS application instances, further enhancing performance and availability.But for most small and medium-sized enterprises, a single AnQiCMS instance combined with a reverse proxy can meet most needs.

Log analysis:

Related articles

How to configure the pseudo-static rules for Nginx reverse proxy for AnQiCMS multi-site?

As a senior security CMS website operator, I am well aware that the efficient operation of a content management system is crucial for website operators, especially when it comes to multi-site management and SEO optimization.AnQi CMS, developed in Go language, provides us with a powerful content publishing and management platform with its high performance and flexible multi-site support.Today, I will give a detailed introduction on how to configure pseudo-static rules for multi-site AnQiCMS in the Nginx environment, ensuring that your website can enjoy optimized URL structure and smooth access experience.### Deep Understanding

2025-11-06

How to modify the default port of an AnQiCMS instance specifically?

As an experienced AnQiCMS website operations personnel, I know that every detail of the system configuration is related to the stability and security of the website.Modifying the default port of the AnQiCMS instance is a common requirement in website deployment and security optimization, especially when you need to run multiple AnQiCMS instances on the same server or avoid using the default port for security reasons.Below, I will explain to you in detail how to operate.

2025-11-06

How to deploy multiple CMS instances on a single AnQiCMS server?

As an experienced website operator proficient in AnQiCMS, I fully understand the importance of efficiently and flexibly managing multiple websites under the growing business demands.Sometimes, this means we need to deploy multiple independent CMS instances on a single server to meet different project requirements or higher isolation requirements.AnQiCMS is an enterprise-level content management system based on the Go language, with its lightweight and efficient characteristics, it is very suitable for such deployment scenarios.

2025-11-06

How does the multi-site function of AnQiCMS support cross-site data sharing?

As an experienced website operator familiar with AnQiCMS, I am well aware of the importance of multi-site management for modern content operations.It not only helps enterprises efficiently manage multiple brands or product lines, but also enables effective circulation of resources and content between different sites.AnQiCMS provides strong and flexible support in this field, especially in cross-site data sharing, demonstrating its unique advantages.Explore the multi-site architecture of AnQiCMS AnQiCMS is positioned to serve small and medium-sized enterprises, self-media operators, and multi-site management needs users

2025-11-06

Does AnQiCMS support independent SEO optimization for each site in multi-site mode?

HelloAs an experienced website operator familiar with AnQiCMS, I can clearly tell you that AnQiCMS fully supports independent SEO optimization for each site in multi-site mode.This is part of the core design concept of AnQiCMS, aiming to provide an efficient and flexible content management and promotion solution for enterprises with multiple brands, sub-sites, or content branches.

2025-11-06

How can AnQiCMS multilingual support be applied to multi-site deployment?

As an experienced CMS website operation personnel in the security industry, I fully understand the importance of multilingual and multi-site strategies in expanding business and enhancing user experience in today's increasingly globalized market.AnQi CMS provides a powerful and flexible solution to achieve this goal with its high efficiency and customizable features.The following will elaborate on how Anqi CMS's multilingual support plays a role in multi-site deployment.

2025-11-06

What is the minimum version requirement for installing AnQiCMS via Docker on Baota panel?

As an experienced security CMS operator, I know the importance of a stable and efficient content management system for a corporate website.Among many deployment solutions, Baota panel combines Docker container technology to provide a convenient and flexible installation method for Anqi CMS.However, it is crucial to clarify the minimum version requirements before proceeding with the installation, as this can effectively avoid potential compatibility issues and ensure smooth system operation.

2025-11-06

How to install and configure MySQL before deploying AnQiCMS Docker multi-site?

As an experienced CMS website operation person in an enterprise security field, I know that the stability and security of the database are of great importance when deploying a multi-site environment.Especially in the context of Docker container deployment, efficiently installing and configuring MySQL is the first step to ensure smooth operation of the AnQiCMS multi-site.Next, I will elaborate on this key link. --- ### How to install and configure MySQL before deploying AnQiCMS Docker multi-site

2025-11-06