What is the practice of installing multiple AnQiCMS sites on the same server?
As a senior AnQi CMS website operations personnel, I know how important it is to manage multiple websites efficiently on a single server.The AnQi CMS was designed with the need for multi-site management in mind, providing users with a flexible and powerful solution.The following article will detail the **practice** of installing and managing multiple AnQiCMS sites on the same server.
To deploy multiple AnQiCMS sites on the same server, the core goal is to maximize resource utilization, simplify management processes, and ensure the independent operation and stability of each site.AnQiCMS provides two main implementation paths, each suitable for different management preferences and resource isolation needs.
Firstly, it is also a strongly recommended practice to make use of the built-in "Multi-site Management" feature of AnQiCMS.This method uses an instance of the running AnQiCMS application to host and manage multiple logically independent websites.The advantage lies in the significant reduction of server resource consumption, as you only need to run a Go language process, rather than starting a separate process for each site.Moreover, this centralized management model simplifies the update and maintenance of AnQiCMS itself, with all sites sharing the same AnQiCMS core, facilitating unified upgrades and the deployment of security patches.
To implement this pattern, first make sure that there is a stable AnQiCMS main instance running on your server.This can be done through a Docker container (as shown in the Docker installation tutorial using Baota panel) or by directly deploying the Go binary file.AnQiCMS usually listens on a specific port, such as the default 8001.Next, you need to configure reverse proxy for each new site on an external web server (such as Nginx or Apache)This means that when a user accesses the domain name of the new site, the request will be captured by the web server and then forwarded to the port that the AnQiCMS main instance is listening on.In the configuration of the web server, make sure to set the correct runtime directory for the new domain (usually pointing to/publicDirectory, especially for direct deployment cases), and all traffic is proxied to the AnQiCMS port.
Configure the reverse proxy and then you can log in to the backend management interface of the AnQiCMS main instance.In the "Multi-site Management" feature, select "Add New Site".Here, you will fill in all the key information for the new website: including the name of the site, the external access website address (i.e. the URL of the new domain), an independent administrator account and password for the new site, and a unique database name.AnQiCMS will create an independent database for each logical site to ensure that data is not interfered with.It is worth noting that if your AnQiCMS is running as a Docker container and the database is already configured, you can usually reuse the default database connection information, the system will automatically handle the creation and isolation of the database.In this case, you still need to specify a unique site root directory for each new site (for example, in a Docker environment, it can be/app/new_site_domain_comused to store the independent cache, uploaded files, and other resources of the site.
Another implementation is to run multiple completely independent AnQiCMS application instances on the same server.Each instance has its own AnQiCMS binary file, configuration file, and listening port.This mode provides the maximum degree of site isolation, and the failure or performance issues of each website will not directly affect other websites.If each of your sites has a high degree of independence requirements, or if you need to allocate different server resources to each site (although this is not common on a single server), this method may be more suitable.
You need to perform a complete AnQiCMS installation process for each site to deploy multiple independent AnQiCMS instances.This means that each site will have an independent AnQiCMS installation package extraction directory.A crucial step is to modify each instance'sconfig.jsonFile, set its listening port to an unused, unique port number (such as 8001, 8002, 8003, etc.). At the same time, the startup script for each instance (such asstart.sh) Also need to adjust to ensure it points to the correct AnQiCMS binary file and listens to its exclusive port.Finally, as with the previous method, you need to configure reverse proxy for each site on the external web server (Nginx or Apache), but this time, each site's domain will be proxied to the unique listening port of its corresponding AnQiCMS instance.Each instance needs to complete the initialization installation process independently when accessed for the first time.
No matter which multi-site deployment plan is chosen, there are some common operational considerations.First is resource management, even though the Go language itself is efficient, running multiple Go processes or a process managing multiple sites requires a reasonable assessment of the server's CPU, memory, and disk I/O.The next is domain resolution, all domains to be hosted must be correctly resolved to your server IP address.The configuration of SSL/TLS certificates should also be completed on the external web server to ensure secure access to all sites.It is crucial to have a backup strategy, whether it is for multiple independent databases or a multi-site managed database, regular and reliable backups are the foundation of data security.Finally, continuous monitoring of servers and sites can help you quickly detect and resolve potential performance or security issues.
In conclusion, the multi-site capability of AnQiCMS brings great convenience to website operators.By reasonable planning and configuration, whether using built-in multi-site management functions or deploying multiple independent instances, multiple secure CMS-driven websites can run efficiently and stably on a single server.
Frequently Asked Questions (FAQ)
Question one: What are the main differences between the built-in multi-site management and running multiple independent AnQiCMS instances in AnQiCMS?
The built-in multi-site management feature of AnQiCMS allows a single AnQiCMS application process to manage multiple logically independent websites.These websites share the same AnQiCMS core program, but they are isolated in terms of database, file storage paths (such as uploaded files, caches, etc.), and management background permissions.This way resource utilization is high, and the management and upgrade of the AnQiCMS core program are more centralized and convenient.Running multiple independent AnQiCMS instances means that each website has an independent AnQiCMS process running, which are completely separated and do not affect each other.This provides the highest isolation, but consumes more server resources (such as memory and CPU), and the maintenance and upgrade of each instance need to be carried out separately.Generally, for most users, using the built-in multi-site management feature is more efficient and recommended.
Question two: How to handle database management in a multi-site environment?
When using the built-in multi-site management feature of AnQiCMS, each new site added is required to specify a unique database name.AnQiCMS will automatically create and use this new database on the database server you configured to store the site's data.This means that the data of all sites is logically separated, but they may all be located in the same MySQL (or other database) instance.If you are running multiple independent AnQiCMS instances, then each instance will have its own independentconfig.jsonConfigure, pointing to its dedicated database. Regardless of the method, the data isolation of the database is guaranteed.In order to ensure data security, you should formulate a comprehensive database backup strategy to ensure that the databases of all sites can be backed up regularly.
Question three: Can I migrate an existing single AnQiCMS site to a multi-site management architecture?
Yes, it is completely feasible. If you have a single AnQiCMS site that is already running and you want to integrate it into a multi-site management architecture, you can manage other newly created sites as the 'master site'.In some cases, the document also mentions that AnQiCMS can be converted into a Go project when upgrading from version 2.x to 3.x, and can be merged with other sites to use a single AnQiCMS deployment management.The specific operation may involve: first ensure that the existing site is running on the recommended deployment method (such as Docker or Go project).Then, use the "Multi-site Management" feature in the AnQiCMS backend to add a new site and configure reverse proxy for the new site.If you need to convert an existing site from an independent instance mode to one of the logical sites in the built-in multi-site mode, you may need to make more detailed configuration adjustments, including ensuring that its database and file paths are compatible with the new multi-site framework, but this is usually considered in AnQiCMS design.Make sure to make a complete backup of the existing site's data and configuration before making any major changes.