Introduction
Understanding AnQiCMS multi-site mechanism
Before delving into the configuration, it is first necessary to clarify the multi-site operation principle of AnQiCMS.AnQiCMS has a core advantage that a running AnQiCMS instance (usually listening on a specific port, such as 8001) can serve multiple different front-end domain names through its built-in multi-site management feature.Nginx plays the role of traffic distribution and reverse proxy here, it forwards requests to the same AnQiCMS backend port according to the different domain names accessed by users.AnQiCMS backend then identifies which site is initiating the request based on the Host header information forwarded by Nginx, and provides the corresponding site content.This means you do not need to run an independent AnQiCMS process for each site, thereby saving server resources and simplifying management.
Preparation
Before starting the configuration, please ensure that your Linux server meets the following conditions:
- Linux operating system:Recommend using Ubuntu, CentOS, and other mainstream distributions.
- Nginx is installed and running:Nginx will act as your reverse proxy server.
- MySQL database is installed and running:AnQiCMS requires a database to store data.
- Domain resolution:All the domain names you plan to use for multiple sites have been correctly resolved to your server IP address.
Deploy the main AnQiCMS instance
Firstly, we need to deploy and initialize an AnQiCMS master instance on the server. This instance will be the backend service provider for all other sites.
Download and extract
Please download the latest Linux version installation package from the AnQiCMS official website and upload it to your server. Usually, we would place it in a meaningful directory, such as/www/wwwroot/anqicms_mainEnglish.
Extract the installation package:tar -xzvf anqicms-linux-vX.x.x.tar.gz -C /www/wwwroot/anqicms_mainEnter the directory after extraction:cd /www/wwwroot/anqicms_main
Daemon process configuration
To ensure that AnQiCMS service can automatically start after the server restart and run stably, we usually usecrontabto set up a daemon. Create a namedstart.shThe startup script of/www/wwwroot/anqicms_mainis located in the directory, the content is as follows:
#!/bin/bash
BINNAME=anqicms
BINPATH=/www/wwwroot/anqicms_main
exists=`ps -ef | grep '\<anqicms\>' |grep -v grep |wc -l`
if [ $exists -eq 0 ]; then
cd $BINPATH && nohup $BINPATH/$BINNAME >> $BINPATH/running.log 2>&1 &
fi
Add execute permission to the script:chmod +x /www/wwwroot/anqicms_main/start.shNext, add this script tocrontabIn English, it makes it check AnQiCMS every minute to see if it is running, and if not, it starts it:crontab -eIn the opened editing interface, add the following line and save and exit:*/1 * * * * /www/wwwroot/anqicms_main/start.shPerform a manual startup script execution to ensure that the AnQiCMS service has started running:/www/wwwroot/anqicms_main/start.sh
Main site Nginx configuration
Configure Nginx reverse proxy for your first (main) AnQiCMS site.