As an experienced AnQiCMS website operations personnel, 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 article will detail this merger process, helping you complete the upgrade smoothly.

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

With the launch of AnQiCMS 3.x version, the multi-site management mode has brought innovation.Different from the need to independently deploy multiple programs for version 2.x, version 3.x can manage multiple independent sites through a single core program.This pattern not only simplifies server resource allocation and reduces maintenance costs, but more importantly, it provides a unified backend entry, allowing you to easily switch and manage all site content, users, and settings in one interface.

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.The multi-site feature of AnQiCMS 3.x 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 multi-site management does not physically merge the database content 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.Data for each site (such as articles, categories, pages) is still stored in its respective database, and files (such as uploaded images, templates) are also kept in the respective site root directory.The management backend of 3.x provides a centralized entry and switching mechanism.

Preparation and Data Backup

Any operation involving system upgrade and data migration requires a detailed backup as an indispensable first step. Before you begin the merge, please make sure you have completed the following preparations:

First, make a full backup of the database for all existing AnQiCMS 2.x sites.This usually means exporting the SQL file of the database. Next, backup all files of each 2.x site, including program files, uploaded images, videos and other resources, as well as any custom templates or configuration files.Store these backups in a safe and easily recoverable location.

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 of the site files.This information is crucial during the addition process to the 3.x new 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 of AnQiCMS 3.x.This site will carry the unified management entrance for all other 2.x sites.

First, log in to the backend management interface of the 2.x site you have selected, and upgrade it to the latest 3.x version through the system upgrade feature.After completing the online upgrade, please manually adjust the operation 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 process first.Then, follow the recommended deployment method of AnQiCMS 3.x (for example, the 'Go project' or 'General project' function on Baota panel), and configure the site as a new 3.x application.When configuring, 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.

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

Stop and organize the other 2.x site instances

After the main site has been successfully upgraded and is running, you need to clean up the 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.Due to the adoption of a single application, multi-site management model in 3.x, these old independent running instances are no longer needed. Stopping them can avoid port occupation and resource conflicts.This operation only stops the program from running, it will not affect the site's data and files, which are what we will be using 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.

Log in you have upgraded to the background of the main site version 3.x.Find the "Multi-site Management" feature in the left menu and click the "Add New Site" button.In the pop-up form, you need to fill in the following information accurately:

  • Site Name:Name a site 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 examplehttp://old-site.com)
  • Administrator account and password:Set a separate administrator account and password for this newly added site.
  • Database name:Reiterate, enter the database name of the original 2.x site here. The 3.x system will automatically connect and inherit all the content data from the database, without the need to reinitialize.
  • Database information reuse: Tick the box 'Reuse default database account information', as we are managing in the same Docker or server environment, the database username and password are usually shared.If you are using a separate database account for your original 2.x site, you need to uncheck and fill in the details accordingly.
  • Select the template to use:Choose the appropriate template based on the template compatibility of your original 2.x site.

After filling in, click "OK" to complete the addition of the new site. Repeat this process to add all required 2.x sites one by one to the 3.x multi-site management.

Configure Web Server Reverse Proxy

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

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 listening port (for example, the previously set 8001).This means, when the user visitshttp://old-site.comWhenhttp://127.0.0.1:8001it is handled by the unified AnQiCMS 3.x application.

In Nginx, you need to create a site for eachserverblock, and thenproxy_passPoint tohttp://127.0.0.1:8001. For Baota panel users, you can add a new reverse proxy under "Website" -> "Reverse Proxy", and set the target URL to the samehttp://127.0.0.1:8001. Make sure each site's "Running Directory" is set