As a senior website operations expert, I am well aware that how to deploy efficiently and without conflict when managing multiple websites is the key to success.Auto CMS (AutoCMS) provides us with great convenience with its excellent multi-site management capabilities.Today, let's delve into how to cleverly set the root directory and database name of a new site when deploying AnQiCMS multi-site with Baota panel, in order to avoid annoying conflicts and ensure that each site can run independently and stably.

The strength of AnQi CMS lies in its ability to manage multiple content sites through a simple and efficient system architecture.This means that you do not need to reinstall a complete CMS system for each new website, but instead, expand your website matrix through the built-in multi-site functionality of a core AnQiCMS program.This design concept greatly reduces operation and maintenance costs and resource consumption, and also puts forward refined requirements for how we configure in environments like Baota Panel.

Panel and considerations under Docker environment

The key here is that although all external requests converge to the same AnQiCMS container, AnQiCMS itself has strong multi-site recognition and management capabilities.It can load and process the configuration and data of the corresponding site according to different domain names.To allow AnQiCMS to correctly distinguish and independently store the data of each site, we need to set the "root directory" and "database name" of the new site precisely and uniquely in its background settings.

Core: Setting of the root directory of the new site

When adding a new site in the multi-site management interface of AnQiCMS, 'Site Root Directory' is a very important parameter. It does not refer to the physical website root directory you create for the domain in the Baota panel (for example,/www/wwwroot/yourdomain.com),而是AnQiCMS Docker容器内部用于存储该站点独立数据(如缓存文件、上传的图片、日志等)的路径。

To avoid data confusion and file conflicts between different sites, we must ensure that each new site's root directory is unique. The recommended practice by AnQiCMS is: to/app/as a prefix (because/app/is the default working directory inside the AnQiCMS Docker container), then format your domain name, for example, replace thedev.anqicms.comwith a dot (.) with underscores (_)。Thus, the root directory of the new site can be set to/app/dev_anqicms_com.

There are several obvious advantages to doing this:

  • Uniqueness guarantee:The directory name generated based on the domain name is almost never duplicated, ensuring that each site has an independent file storage space.
  • High recognition degree:It is clear from the directory name which site it belongs to, which is convenient for management and troubleshooting.
  • Follows the Docker path convention: /app/Prefix keeps consistent with the file system structure inside the Docker container, avoiding the hassle of path mapping.

Please pay close attention to,/app/dev_anqicms_comthe directory isin AnQiCMS Docker containerThe, you do not need to manually create it in the server's file system, AnQiCMS will automatically handle it when creating a site.

Core: Setting of the database name

Similar to the root directory, the 'database name' of a new site also needs to have a high degree of uniqueness to ensure that the core data (articles, users, configurations, etc.) of each site can be completely isolated and not interfere with each other.

When adding a new site in AnQiCMS backend, it is recommended that you use a naming strategy similar to the root directory: use the dot in the domain name of the site,.) with underscores (_),and use it as the database name. For example, if your new site domain isdev.anqicms.com,then the database name can be set todev_anqicms_com. Some operators may be accustomed to adding an extra_dbfull suffix, for exampledev_anqicms_com_dbThis is also a good choice, which can more clearly identify that this is a database name.

Another key point is the option of “database information reuse”.If you are deploying AnQiCMS in a Docker environment and have already installed MySQL via Docker (for example, installed from Baota's app store), then your AnQiCMS container will usually be configured to use this unified MySQL service.In this case, it is strongly recommended that you check the box for.This means that AnQiCMS will use its main site's credentials to create a new database for the new site.Since AnQiCMS's Docker installation typically has management permissions for the MySQL service, it can smoothly create new database instances for you without requiring you to manually configure a new database user or password.This greatly simplifies the management complexity of multi-site databases.

Operation steps summary

In summary, the process of deploying AnQiCMS multi-site on the Baota panel and avoiding naming conflicts with the root directory and database can be summarized as:

  1. Baota panel side:Add a website for each new domain and configure a reverse proxy to forward requests to the port where the AnQiCMS Docker container is running (for examplehttp://127.0.0.1:8001).
  2. AnQiCMS backend side:Log in to the main site backend, go to 'Multi-site Management', click 'Add New Site'.
    • Site Root DirectorySet to:/app/您的域名_com[for example]/app/dev_anqicms_com).
    • Database nameSet to:您的域名_com[for example]dev_anqicms_com).
    • Check .

Through this unified and standardized naming strategy, you can not only avoid potential conflicts, but also establish a clear and easy-to-manage system of website assets.


Common Questions (FAQ)

1. Why should the root directory of the new site be/app/at the beginning instead of directly specifying an absolute path on the server?

This is mainly to adapt to the running mechanism of AnQiCMS in the Docker environment. When AnQiCMS is deployed as a Docker container,/app/is the working directory of the AnQiCMS program inside this container. All file operations inside the container are based on this path. Therefore, the root directory of the new site should be set to/app/The subdirectory is the key to ensure that the AnQiCMS container can correctly create and manage independent resources such as cache, logs, and uploaded files for the site.If it is not a Docker environment, for example, installing directly on a physical server, then the root directory path should be the actual absolute path in the server's file system.

2. Can I run an unlimited number of sites in an AnQiCMS container? How does server resources affect multi-site performance?

Theoretically, AnQiCMS supports managing multiple sites within a single container, and its design is inherently tailored for multi-site requirements.However, the number of sites that can run stably is limited by the physical resources of your server, including CPU, memory, hard disk I/O, and bandwidth.