As an experienced website operations expert, I know that how to efficiently and conflict-free deploy multiple websites is the key to success.AnQiCMS (AnQiCMS) provides us with great convenience with its excellent multi-site management capabilities.Today, let's delve deeply 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 install a complete CMS system for each new website, but instead, expand your website matrix by using the built-in multi-site function of a core AnQiCMS program.This design concept greatly reduces O&M costs and resource consumption, and also puts forward refined requirements for how we configure in environments like Baota Panel.
Tencent Cloud Panel under Docker Environment Considerations
When deploying AnQiCMS on Baota panel, many users will choose the Docker containerization method.The advantage of this method lies in environmental isolation and the convenience of deployment.When AnQiCMS runs as a Docker container and listens on a specific port (such as the default 8001), the main task of Baota panel is to configure a reverse proxy for each new site.This means that regardless of how many independent domain names you have, they will all go through reverse proxy at the Baota panel level and ultimately forward access requests to the same AnQiCMS Docker container's 8001 port.
The key point 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 based on different domain names.In order to allow AnQiCMS to correctly distinguish and independently store data for each site, we need to accurately and uniquely set the 'root directory' and 'database name' in the background settings for new sites.
Core: Setting of the New Site Root Directory
When adding a new site in the multi-site management interface of AnQiCMS, the "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) Instead, it is the path used within the AnQiCMS Docker container to store the independent data of the site (such as cache files, uploaded images, logs, etc.)
To avoid data confusion and file conflicts between different sites, we must ensure that the root directory of each new site is unique. The recommended practice by AnQiCMS is to: with/app/As a prefix (because/app/is the default working directory inside the AnQiCMS Docker container), then format your domain name, for example, replacedev.anqicms.comthe dot (.) with underscores (_)。So, the root directory of the new site can be set to/app/dev_anqicms_com.
There are several obvious benefits to doing this:
- Uniqueness guarantee:Directory names generated based on domain names are almost unique, ensuring that each site has independent file storage space.
- High recognition:It can be clearly identified from the directory name which site it belongs to, convenient for management and troubleshooting.
- Complies with Docker path conventions:
/app/The prefix maintains consistency with the file system structure inside the Docker container, avoiding path mapping issues.
Please pay close attention to this/app/dev_anqicms_comdirectory isInside the AnQiCMS Docker containerUsed, you do not need to manually create it in the server's file system. AnQiCMS will automatically handle it when creating a site.
Core: Database name setting
Similar to the root directory, the "database name" of a new site also needs to have high 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 the AnQiCMS backend, it is recommended that you use a naming strategy similar to the root directory: using 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 add one more_dba suffix, for exampledev_anqicms_com_dbThis is also a good choice, it can 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 through Docker (such as MySQL installed in the Baota 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 option [Reuse default database account information].This means that AnQiCMS will use its main site's MySQL credentials to create a database for the new site.Since the Docker installation of AnQiCMS usually has management permissions for the MySQL service, it can smoothly create a new database instance for you without the need for you to manually configure a new database user or password.This greatly simplifies the management complexity of multi-site databases.
Summary of operation steps
In summary, the process of deploying AnQiCMS multi-site on Baota panel and avoiding naming conflicts between the root directory and the database can be summarized as:
- 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 example
http://127.0.0.1:8001) - AnQiCMS backend side:Log in to the main site backend, go to "Multi-site Management", click "Add New Site".
- Site root directory: Set to
/app/您的域名_comfor example/app/dev_anqicms_com) - Database name: Set to
您的域名_comfor exampledev_anqicms_com) - Check 【Reuse default database account information】.
- Site root directory: Set to
By using this unified and standardized naming strategy, you can not only avoid potential conflicts, but also establish a clear and easy-to-manage website asset system.
Frequently Asked Questions (FAQ)
1. Why should the root directory of the new site start with/app/instead of directly specifying an absolute path on the server?
This is mainly to adapt to the operation mechanism of AnQiCMS in the Docker environment. When AnQiCMS is deployed as a Docker container,/app/It is the working directory of the AnQiCMS program inside the container. All file operations inside the container are based on this path. Therefore, the root directory of the new site is 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 do server resources affect the performance of multiple sites?
In theory, AnQiCMS supports managing multiple sites within a container, its design is inherently for multi-site needs.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.Each active site will