Deployment of multiple sites on the same server for AnQi CMS

Calendar 👁️ 0

AnQiCMS supports running multiple independent sites on the same server, each with its own domain name, database, template, and administrator. This chapter thoroughly describes the complete steps and precautions for multi-site configuration.


Plan 1: Multi-site management (recommended)

Applicable conditions: There is already an installed and running AnQiCMS main site.

This plan uses the built-in features of AnQiCMSMulti-site managementFunction, all sites share the same AnQiCMS program but run independently. No need to copy multiple copies of the code.

Preparation

  1. An AnQiCMS main site has been deployed and is running normally (port 8001).
  2. The main site hasMulti-site managementMenu permissions (default installed sites have them).
  3. The new site's domain has been resolved to the server
  4. Prepare the database information for the new site (can be automatically created during installation).

Create a new site entry in the Baota panel

  1. Baota panel →websiteAdd Site
  2. PHP versionSelectstatic
  3. FTPandDatabaseSelect allDo not create
  4. Enter the domain name of the new site (such asstudy.ykbh168.com)
  5. Record the root directory of the site (such as/www/wwwroot/study.ykbh168.com)
  6. ClickSubmit

install-bt5.png

Add a new site in AnQiCMS backend

  1. Login to the main site backend
  2. → Click the menu on the leftMulti-site management(/website)
  3. ClickAdd a new site
  4. Enter the following information:
field Description
Site name A name that is easy to distinguish, such as "Study Blog"
website address The domain name of the new site,https://study.ykbh168.com
Site root directory The directory recorded in the previous step, such as/www/wwwroot/study.ykbh168.com
Administrator account The administrator username of the new site
Administrator password The administrator password of the new site
Database name The new database name (do not repeat with existing databases)
Reuse database account f the main site uses the root account, it is recommended to check it to avoid repeated entry

install-bt6.png

  1. ClickConfirm

Configure Nginx for the new site

  1. Baota panel → New site →setting
  2. site directory→ Set the run directory to/public→ Save

install-bt7.png

  1. Static→ Enter reverse proxy rules:
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;
}

install-bt8.png

If using Apache, inReverse Proxyenter the target URLhttp://127.0.0.1:8001Just do it.

Apache configuration details of pseudo-static

If Nginx is not available, use Apache as the web server and configure it as follows:

  1. Baota panel → New site →settingStatic→ Clear pseudo-static rules
  2. SelectReverse ProxyTab
  3. Target URLFill inhttp://127.0.0.1:8001
  4. ClickSave

install-bt10.png

Apache Virtual Host Configuration Example(Manually edit httpd-vhosts.conf):

<VirtualHost *:80>
    ServerName study.ykbh168.com
    DocumentRoot /www/wwwroot/study.ykbh168.com/public
    
    ProxyPass / http://127.0.0.1:8001/
    ProxyPassReverse / http://127.0.0.1:8001/
    
    <Directory /www/wwwroot/study.ykbh168.com/public>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
    ErrorLog /var/log/httpd/study-error.log
    CustomLog /var/log/httpd/study-access.log combined
</VirtualHost>

Note: To use Apache, you need to enablemod_proxyandmod_proxy_httpModule:

> a2enmod proxy proxy_http
> systemctl restart apache2
> ```

### 验证新站点

1. 浏览器访问新站点域名
2. 应正常显示网站首页
3. 访问 `新域名/system/` 进入后台
4. 使用新站点独立的管理员账号登录

---

## 方案二:独立多进程部署

> **适用条件**:需要完全隔离运行环境(如不同客户、不同版本的 AnQiCMS)。
>
> 此方案为每个站点运行一个独立的 AnQiCMS 进程,互不干扰。

### Step 1:复制多份代码

将 AnQiCMS 程序复制到多个目录:

```bash
# 站点 A
cp -r /data/wwwroot/anqicms /data/wwwroot/site-a
# 站点 B
cp -r /data/wwwroot/anqicms /data/wwwroot/site-b

Step 2: Change port

Edit each site'sconfig.json, allocate different ports:

# 站点 A - config.json
{
    "server": {
        "port": 8001
    }
}

# 站点 B - config.json
{
    "server": {
        "port": 8002
    }
}

# 站点 C - config.json
{
    "server": {
        "port": 8003
    }
}

Step 3: Rename the executable file

Rename the executable file to a distinguishable name to avoid process name conflicts (it is recommended to use the middle letter of the domain name):

# 站点 A(域名为 taobaoke.com)
mv /data/wwwroot/site-a/anqicms /data/wwwroot/site-a/taobaoke

# 站点 B(域名为 jianshu.com)
mv /data/wwwroot/site-b/anqicms /data/wwwroot/site-b/jianshu

Step 4: Modify the startup script

Edit each site'sstart.sh, willBINNAMEChange to the corresponding new name,BINPATHChange to the corresponding directory:

# 站点 A start.sh
BINNAME=taobaoke
BINPATH=/data/wwwroot/site-a

# 站点 B start.sh
BINNAME=jianshu
BINPATH=/data/wwwroot/site-b

Modify at the same timegrep '\<anqicms\>'ofanqicmsFor the newBINNAME.

Step 5: Configure Nginx

Configure independent Nginx reverse proxy for each site,proxy_passPoint to their respective ports:

# 站点 A
server {
    server_name taobaoke.com;
    root /data/wwwroot/site-a/public;
    
    location @AnqiCMS {
        proxy_pass http://127.0.0.1:8001;  # 对应站点 A 的端口
        ...
    }
    ...
}

# 站点 B
server {
    server_name jianshu.com;
    root /data/wwwroot/site-b/public;
    
    location @AnqiCMS {
        proxy_pass http://127.0.0.1:8002;  # 对应站点 B 的端口
        ...
    }
    ...
}

Step 6: Add scheduled task

Add an independent crontab keep-alive task for each site:

# crontab 中添加
*/1 * * * * /data/wwwroot/site-a/start.sh
*/1 * * * * /data/wwwroot/site-b/start.sh

Plan 3: Multi-site environment in Docker

Applicable conditions: AnQiCMS has been deployed through Docker (Baota Docker / 1Panel / aaPanel are all available), and it is hoped that more sites can be added on the same server through reverse proxy without creating a new container.

This solution is suitable for AnQiCMS deployed on Docker, using the reverse proxy function of Baota (or 1Panel) to direct multiple domain names to the same 8001 port of a Docker container, and then differentiate different sites through the built-in multi-site management function of AnQiCMS.

Step 1: Add reverse proxy site

Baota panel operation:

  1. Baota panel →websiteReverse ProxyAdd Reverse Proxy
  2. Fill in the following configuration:
Configuration item Fill in the content
Domain New site domain (such asdev.anqicms.com)
Target URL http://127.0.0.1:8001(Port mapped by Docker container)
  1. ClickConfirmComplete creation

1Panel operation:

  1. 1Panel →websiteCreate a website→ SelectReverse Proxy
  2. Enter the main domain name for the new site, fill in the proxy address127.0.0.1:8001
  3. ClickConfirm

Step 2: Add a new site in the AnQiCMS backend

  1. Log in to the main site backend →Multi-site managementAdd a new site
  2. Enter the following information (note the difference from normal deployment):
field Description
Site name Fill in according to the actual situation
Site root directory Start with/app/Start with, such as/app/dev_anqicms.com(Root directory of the Docker container,Do notUse the host machine path)
website address New site domain name, such ashttp://dev.anqicms.com
Administrator account Administrator account for the new site
Administrator password The administrator password of the new site
Database name New database name, such asdev_anqicms_com(Do not duplicate existing libraries)
Duplicate database information SelectReuse the default database account information(Docker environment has complete database permissions)
Select the template to use Select According to Requirement

Key distinction: In the Docker environment, the site root directory is the container path (/app/...), not the host path (such as)/www/wwwroot/...)

Step 3: Use the new site

After creation, the new site can be accessed directly. The back-end address ishttp://新域名/system/.


Plan comparison

Comparison item Multi-site management (Solution 1) Independent multi-process (Solution 2) Docker multi-site (Solution 3)
Management method Unified background management Independently managed Unified background management
Resource utilization Low (shared process) High (independent process) Low (shared process)
Configuration complexity Simple More complex Simple
Isolation Shared program code Fully isolated Shared Docker container
Version consistency Unified Version Independent versions Unified Version
Applicable scenarios Multiple sites for the same customer Different customers, different projects Docker deployment environment

SuggestionRecommended in most cases:Plan one (multi-site management)Easy to manage, low resource consumption.


❓ Are the data between sites in Plan one completely isolated? Can administrators manage independently?

Data aspect:The database is completely isolated. Each site uses an independent database, and the articles, categories, users, and other data of one site will not leak to other sites.

Regarding administrators:Management permissions are independent. Each site's administrator can only manage their own site and cannot see or operate the content of other sites.

However, it should be noted that all sitesshare the same AnQiCMS program, so:

  • Version upgrades will affect all sites simultaneously
  • Template files are placed in the sametemplate/Under the directory
  • All background management entries are域名/system/

If you want to isolate completely (different customer, different version requirements), please use plan two.

❓ In plan two, the startup script cannot detect the process (always shows 0), but the program is actually running, what should you do?

This isstart.shofgrepCaused by a mismatch in the mode. The default startup script is hardcoded.grep '\<anqicms\>'But if you rename the executable file to another name (such astaobaoke), you need to modify the startup script synchronously.

Modification method:

# 编辑对应站点的 start.sh
# 找到这行:
exists=`ps -ef | grep '\<anqicms\>' |grep -v grep |wc -l`
# 将 anqicms 改为新的进程名:
exists=`ps -ef | grep '\<taobaoke\>' |grep -v grep |wc -l`

Similarly,stop.shofkillThe command also needs to be modified accordingly.

The best way to avoid this problem:Rename it directly with a meaningful name, rather than making arbitrary changes, ensurestart.shThe process name withBINNAMEidentical.

❓ In multi-site mode, is the background entry of each site /system/? Can two sites with different domain names share the same /system/ address?

Yes, the background entry of each site ishttps://该站点域名/system/. Because Nginx reverse proxy distributes requests to the corresponding site based on the domain name, so:

  • Accesshttps://site-a.com/system/→ Enter the background of site A
  • Accesshttps://site-b.com/system/→ Enter the background of site B

These are two completely different addresses, no conflict. Nginx distinguishes them throughserver_name.

❓ Question Answer ④: What should you do when prompted with 'The database name already exists' while adding a new site in Plan 1?

This means that there is already a database with the same name existing. Solution:

method Operation Recommended
Change the name When adding a site, enter a new, unused database name ✅ Simplest
Delete the old database and start over Delete the old database using the MySQL command line before installation ⚠️ Old data will be lost
Use the existing database Manually enter the existing database name in the background (make sure the table structure is compatible) ❌ Not Recommended

Related articles

Source code compilation installation of AnQi CMS

Target audience: Developers who need secondary development, customization features, or whose needs cannot be met by the official binary packages. Difficulty: ⭐⭐⭐⭐ (requires familiarity with GoLang and command line operations) Prerequisites Software version requirements Description GoLang 1.13+ (recommended 1.25+) Compile Go source code Git any version Clone code repository MySQL 5.6.35+ Run database If GoLang has not been installed, please visit https://go.dev/dl/ to download and install.Clone from GitHub (recommended) git clone https://github

2026-07-18

Docker deployment of AnQi CMS

Docker deployment is the fastest installation method for AnQiCMS, suitable for quick experience and testing environments. Docker image address: https://hub.docker.com/r/anqicms/anqicms Method one: Docker command line deployment Suitable for environments where Docker is already installed (any operating system).Quick Start # Pull the latest image docker pull anqicms/anqicms:latest # Run the container docker run -d --name anqicms -p 8001:8001

2026-07-18

Manual deployment of AnQi CMS on the server

Use case: Linux servers without a panel (such as CentOS / Ubuntu), suitable for users familiar with command-line operations.Deployed by downloading the package, configuring Nginx reverse proxy, and MySQL database. Preparations A Linux server (CentOS 7+ or Ubuntu 20.04+) with Nginx and MySQL 5.6.35+ installed (recommended to use the LNMP one-click installation package) A domain name resolved to the server Downloaded AnQiCMS Linux installation package Installation steps Step 1: Download and unzip # Log in to the server ssh

2026-07-18

Installation of Anqi CMS - Deployment with PHPStudy (Xiao Pi panel)

The application scenario: Windows local development environment or Windows server. PHPStudy (Xiao Pi panel) integrates components such as Nginx, MySQL, PHP, and AnQiCMS runs through Nginx reverse proxy.Preparation has been completed PHPStudy (Xiaopi Panel) software running mode has been switched to Nginx + MySQL package A local test domain (such as dev.anqicms.com) or access using IP + port AnQiCMS Windows installation package has been downloaded Installation steps Step 1: Create a site Open PHPStudy

2026-07-18

Installation of Anqi CMS - Baota panel deployment

2.2 Tower Panel Deployment Applicable Version: Tower Panel 7.9.3+. Tower Panel Deployment is divided into two methods: traditional deployment (uploading installation packages, configuring reverse proxy) and Docker one-click deployment. This chapter will introduce the traditional deployment method first.Preparation A Linux server with Baota panel installed (CentOS / Ubuntu / Debian are all okay) A domain name resolved to the server (such as www.anqicms.com) MySQL 5.6.35+ installed (recommended 5.7+ or 8.0) Download AnQiCMS Linux package from the official website or GitHub Method one: Baota 7

2026-07-18

Download and install AnQi CMS

Introduce the various download channels of AnQi CMS installation package (official website, GitHub, mirror site), the method of version selection for different operating systems and architectures, and the file verification method of the installation package to ensure that the correct and complete version is downloaded.

2026-07-10

Installation guide and initialization of AnQi CMS

When you first start AnQiCMS, you need to complete the initial installation, including configuring database connection information, setting up the administrator account password, specifying the site name, and other key steps, which are essential before the system can be officially used.When do you need to initialize The following situations require initialization installation: Scenario Description First deployment Fresh installation AnQiCMS Restore factory settings Clear data and reinstall If installed through Baota Docker or aaPanel Docker, the system will automatically complete the initialization (default account admin / password 123456), no manual initialization process is required.Initialization step Step 1: Ensure AnQiCMS is started

2026-07-18

Installation of AnQi CMS - Troubleshooting common installation issues

Summarize common problems and solutions during the installation of Anqi CMS, covering typical scenarios such as port occupation, database connection failure, blank page, permission error, and missing dependencies, to help users quickly locate and solve problems.Question 1: Port occupied. Phenomenon: After starting AnQiCMS, the website cannot be accessed. Reason: The default port 8001 is occupied by another program.Troubleshooting method: # On Linux / MacOS: Check which process is occupying port 8001 lsof -i:8001 # Example output: # COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME #

2026-07-18