AnQiCMS as an efficient content management system developed based on the Go language usually runs on a specific port of the server, such as the default port 8001.To allow users to access the website through common domain names rather than adding a port number at the end of the address, we need to configure a reverse proxy.Apache is a widely used web server that can well handle this task, acting like an intelligent doorman, forwarding all requests through port 80 or 443 (HTTP/HTTPS) to the AnQiCMS running internally, ensuring that the website content is displayed correctly.

Preparation Work

Before starting the configuration, please ensure that your server is already installed with Apache HTTP Server, and AnQiCMS has been successfully run on the specified internal port (default is 8001). You can run it by executingcurl http://127.0.0.1:8001Check if AnQiCMS responds normally. Moreover, you should also have a domain that has been resolved to your server's IP address.

Enable the necessary Apache modules

The reverse proxy feature of Apache depends on some core modules.On most Linux distributions, these modules are enabled by default, but for safety's sake, it is recommended that you check and ensure that the following modules are enabled.a2enmodOn Debian/Ubuntu systems, or directly edithttpd.confOn CentOS/RHEL systems) to enable them:

sudo a2enmod proxy
sudo a2enmod proxy_http
# 如果需要使用负载均衡,可启用以下模块
# sudo a2enmod proxy_balancer
# sudo a2enmod lbmethod_byrequests
# 如果需要使用HTTPS,请启用SSL模块
sudo a2enmod ssl

Enable the module and restart the Apache service to make the changes take effect:

sudo systemctl restart apache2 # 或 sudo systemctl restart httpd

Configure the Apache virtual host

Next, we need to create an Apache virtual host configuration file for your AnQiCMS website. Usually, these files are located in/etc/apache2/sites-available/(Debian/Ubuntu) Or/etc/httpd/conf.d/(CentOS/RHEL) directory. You can create a file namedyourdomain.com.confa new file (it willyourdomain.comReplace with your actual domain), and edit its content, for example, for HTTP access:

`apacheconf