As an experienced AnQi CMS website operations person, I fully understand your need to unify multiple existing AnQiCMS 2.x sites into the 3.x version for management.AnQiCMS 3.x version has made significant optimizations in multi-site management, aiming to simplify operations and improve efficiency.The following article will detail this merging process, helping you complete the upgrade smoothly.

Unified Management: Merge multiple AnQiCMS 2.x sites into 3.x management

This upgrade and integration means you will say goodbye to the繁琐 of maintaining a separate program, configuring multiple daemons, or independent Docker containers for each site.AnQiCMS 3.x's multi-site feature allows each site to have its own independent database and file storage space, but shares the same AnQiCMS core application at the application level.

Before starting the merge, we need to clarify a key concept: AnQiCMS 3.x's multi-site management does not physically merge the database contents of all sites into a single database, but rather allows a 3.x application instance to recognize and manage multiple independently existing databases and site file structures.Each site's data (such as articles, categories, pages) is still stored in its respective database, and files (such as uploaded images, templates) are also retained in their respective site root directories.3.x provides a centralized entry and switching mechanism.

Preparation and Data Backup

Any operation involving system upgrade and data migration requires a thorough backup as an indispensable first step. Before you proceed with the merge, please ensure you have completed the following preparations:

Next, please carefully record the key information of each 2.x site, including its domain name, database name, database username, database password, and the absolute path to the site files.This information is crucial during the addition process of the new 3.x site.

Upgrade the main site to AnQiCMS 3.x core

We will start from one of your main 2.x sites and upgrade it as the core management instance for AnQiCMS 3.x.This site will serve as the unified management entrance for all other 2.x sites.

First, log in to the back-end management interface of the 2.x site you selected, and use the system upgrade feature to upgrade it to the latest 3.x version.Complete the online upgrade and then manually adjust the running mode according to the actual situation of your server (for example, Baota panel users).If your 2.x site is started by a scheduled task or manual command execution, please stop and remove the old scheduled task or daemon first.Then, configure the site as a new 3.x application according to the recommended deployment method of AnQiCMS 3.x (for example, the "Go project" or "General project" function of Baota panel).At configuration time, please make sure to point to the upgraded AnQiCMS executable file, and use a fixed port (such as the default 8001).This port will be the shared application port for all merged sites.

This step completed, please visit the main site in the browser to confirm that both the front-end and back-end are running normally, and the version has been updated to 3.x.

Stop and organize other 2.x site instances

After the main site has been successfully upgraded and running, you need to clean up other 2.x sites to be merged.

For each remaining 2.x site, please completely stop and delete the original AnQiCMS 2.x running process or scheduled task through the server's task scheduler or process management tool.Since 3.x uses a single application, multi-site management model, these old independent running instances will no longer be needed. Stopping them can avoid port occupation and resource conflicts.This operation only stops the program from running and does not affect the site's data and files, which are exactly what we will use later.

Add the existing 2.x site to 3.x management

Now, we will officially incorporate your other 2.x sites into this unified 3.x management backend.

Login you have upgraded to the main site's backend of version 3.x.Find the "Multi-site Management" feature in the left menu and click the "Add New Site" button.

  • Site Name:Give the new site a name that is easy to identify.
  • Site root directory:This is a very important field. Please enter the actual file root directory path of your original 2.x site (for example/www/wwwroot/old-site.com)。AnQiCMS 3.x will use this directory to store specific files for this site and share static resources with the original site.
  • Website address:Enter the complete access URL of the original 2.x site (for example)http://old-site.com).
  • Administrator account and password:Set independent administrator account and password for this newly added site.
  • Database name:Again, please fill in the original 2.x site database name here. The 3.x system will automatically connect and inherit all the content data in the database without the need to reinitialize.
  • Database information reuse:Tick the box “Reuse default database account information”, because we are managing in the same Docker or server environment, usually the database username and password are shared.If you are using a separate database account for your 2.x site, you need to uncheck and fill in the information truthfully.
  • Select the template you want to use:Choose an appropriate template based on the compatibility of your original 2.x site template.

Fill in the information and click "OK" to complete the addition of the new site. Repeat this process to add all 2.x sites one by one to the 3.x multi-site management.

Configure the web server reverse proxy

After adding all sites to the 3.x backend, you also need to adjust the configuration of the web server (such as Nginx or Apache) to correctly route user access requests.

For each new site added, you need to configure a reverse proxy for it on the web server.All these reverse proxies should point to the same AnQiCMS 3.x application instance's listening port (for example, the previously set 8001).http://old-site.comWhen, the web server will forward the request tohttp://127.0.0.1:8001handled by the unified AnQiCMS 3.x application.

In Nginx, you need to create a new site for eachserverblock, and thenproxy_passpointing tohttp://127.0.0.1:8001. For users of Baota panel, you can add a new reverse proxy under “Website” -> “Reverse Proxy”, and set the target URL accordinglyhttp://127.0.0.1:8001. Make sure the “Running Directory” of each site