As a professional well-versed in the operation of AnQiCMS, I am very willing to explain in detail the naming and configuration strategy of the site root directory when adding a new site in AnQi CMS.Properly planning and setting the site root directory is the key to ensuring stable operation, data security isolation, and convenient maintenance in a multi-site environment.

The positioning and importance of the site root directory

In the multi-site management system of AnQiCMS, the site root directory plays a crucial role.It is not just a folder you physically create on the server, but also a dedicated space for each independent site to store its unique data, cache files, uploaded resources, and other personalized configurations.This isolation mechanism fundamentally avoids data confusion and conflict between different sites, ensuring the independence, security, and operational efficiency of each site.Whether it is handling the cache generated by front-end access or the images, documents, and other files uploaded by users through the backend, they will be stored in order under their respective site root directories.

The naming principle of the site root directory

In order to facilitate management and maintenance, the naming of the site root directory should follow clear, unique and easily identifiable principles.An advisable practice is to closely associate the directory name with the domain name bound to the site..) with underscores (_),so as to build a directory name that conforms to the file system naming conventions and has high recognition. For example, if your new site domain isdev.anqicms.com, then a suitable site root directory name might bedev_anqicms_com.This naming method allows you to identify at a glance the site to which this directory belongs, especially when managing a large number of sites, its advantages will be more evident.The core lies in the fact that the root directory name of each site must be unique to completely eliminate potential naming conflicts.

Site root directory configuration under Docker environment

For users deploying AnQiCMS in Docker container environments, the configuration of the site root directory has certain peculiarities. Within Docker, applications usually run under predefined file system paths, for example, the default root path for AnQiCMS in Docker might be/app/.Therefore, when you add a new site through the multi-site management feature of the AnQiCMS backend, the filling of the "site root directory" field needs to be based on the actual path within the Docker container.

This means that you need to combine the naming principles mentioned above with the path inside the container. For example, if your site domain isdev.anqicms.comThen the 'site root directory' filled in the 'Add New Site' interface in AnQiCMS background should be/app/dev_anqicms_comThis measure is intended to ensure that the data of the new site has a dedicated, non-conflicting storage location within the file system of the Docker container.

Configuration of the root directory of the site installed directly on the server (such as Baota panel)

If your AnQiCMS is directly installed on the server (for example, through Baota panel without Docker deployment), then the configuration of the site root directory is more intuitive, but it still requires careful planning.Before adding a new site, you need to create an independent directory for the new site in the physical file system of the server./www/wwwroot/Create a new folder based on the domain name under the path, for examplewww.yournewsite.com.

Create the physical directory first, when adding a new site in the "Multi-site Management/www/wwwroot/www.yournewsite.comSo, all the dedicated data of the new site will be directly stored in the specified directory.

Integration configuration with the web server

No matter which deployment method you choose, a crucial follow-up step is to properly configure your web server (such as Nginx or Apache) to parse the requests for the new site. The frontend public resources and page content of AnQiCMS are usually from the root directory of the site./publicThe subdirectory provides services. Therefore, your web server (via reverse proxy or direct website root directory settings) must point to the root directory of your new site./publicfolder.

For example, if you set the root directory of the site in the AnQiCMS background/www/wwwroot/yournewsite.comthen the Nginx'srootdirective should be configured asroot /www/wwwroot/yournewsite.com/public;Through reverse proxy, the target address should point to the port where AnQiCMS service is listening, but the actual external document root directory of the web server should still be with/publicAssociated with the catalog to ensure that website resources can be loaded normally.

Through the detailed naming and configuration guidelines above, you can establish a solid, isolated, and easy-to-manage foundation for each new site of AnQiCMS, safeguarding the subsequent content creation and operation.


Common Questions and Answers (FAQ)

What happens if no unique name is specified for the root directory when adding a new site?If the root directory name of the site is duplicated or does not follow the uniqueness principle, the most direct risk is that the data between different sites may become confused or overwritten.This may cause cache conflicts, incorrect file upload paths, and even data corruption, seriously affecting the stability and accuracy of the site's content.Therefore, it is mandatory to specify a unique root directory name for each site as a **practice to ensure data isolation and the normal operation of the system.

2. Can the site root directory be easily changed after it is set and created?In most cases, once the root directory of the site is set and initialized, it is not recommended to change it easily.This is because the directory stores a large amount of site-specific data such as the database connection information, cache, uploaded files, and so on.If it is necessary to change, this will be a complex process, involving manual migration of files, updating database configuration, and web server configuration, and improper operation may lead to the site being inaccessible or data loss.Therefore, it is recommended to fully plan before creating the site to avoid frequent modifications later.

3. Why does the web server need to point the website root directory to the AnQiCMS site root directory?/publicfolder instead of directly pointing to the site root directory itself?Point the web server to/publicThe folder is a general security and structure**practice. AnQiCMS (and many modern CMS) places all publicly accessible resources (such as HTML, CSS, JavaScript, images, etc.) in/publicIn the catalog, while placing the core code, configuration files, database files, and other sensitive contents in/publicOutside the directory. This can effectively prevent users from directly accessing sensitive system files, thereby greatly enhancing the security of the website and preventing potential attacks and information leaks.