In today's digital age, efficient management of multiple websites has become a core need for many businesses and individual operators.AnQiCMS (AnQiCMS) is an enterprise-level content management system based on the Go language, which provides us with an excellent solution with its high performance, ease of use, and support for multiple sites.How to ensure that each site's data is completely independent and does not interfere with each other when deploying multiple AnQiCMS sites on the same server is a crucial issue in operation and maintenance.As a senior website operations expert, I will delve into this point with you.
AnQiCMS's design philosophy is not just to pile up content for multiple sites, but aims to provide an independent and secure data environment for each site in English.This data independence is the foundation for brand differentiation, precise content operation, and information security.Whether you need to establish sub-brand websites for different product lines or provide independent CMS services for multiple clients, understanding and practicing data independent deployment will be the key to success.
The cornerstone of data independence: The three core elements
To ensure that each AnQiCMS site's data is independent, we need to pay attention to the following three core elements, which are like each site's 'exclusive safe' and 'exclusive channel', ensuring that information is not confused:
- Independent database:This is the most fundamental guarantee of data isolation.Each AnQiCMS site should connect to its own dedicated database.This means that even though they run on the same database server, each site has an independent database name, table structure, and storage space.Thus, the content, users, configuration, and other data of one site will be completely isolated from the data of another site, eliminating the risk of data confusion and misoperation from the source.
- Independent file system storage:In addition to the structured data in the database, each site will also generate a large number of unstructured files, such as images, videos, attachments, cache files, configurations (such as
config.jsonLogs, etc.These files should be categorized and stored in their respective independent site root directories, which can effectively avoid file conflicts, permission confusion, and facilitate later backup, recovery, or migration for individual sites. - An independent application instance and port (or logical isolation):Deploying multiple sites means that there will be multiple "AnQiCMS service" running on the server.Each AnQiCMS application instance needs to listen on a unique port to ensure that traffic can be accurately directed to the corresponding site.Even in the multi-site mode built into AnQiCMS, although there may be only one physical application process, it also creates an independent workspace and data context for each site through logical isolation.
The path of practice: two deployment strategies
Understood the core elements of data independence, let's take a look at how to achieve it in practice through two main strategies:
Strategy one: Utilize the multi-site management feature built into AnQiCMS (efficient integration)
This is a deployment method recommended by AnQiCMS and is powerful, especially suitable for the scenario where multiple sites need to be managed through a unified backend entry.In this mode, you only need to deploy one AnQiCMS application instance and manage multiple front-end sites through its management backend.
- Deploy a basic AnQiCMS instance:First, deploy an AnQiCMS master instance on your server according to the official guide of AnQiCMS (such as through Docker, 1Panel, or Baota Panel).This instance will default to listening on a port (such as 8001) and connecting to an initial database.
- Add a new site in AnQiCMS backend:Log in to the backend management interface of this master instance, find the "Multi-site Management
- Site Name:Give the new site a name that is easy to identify.
- Site root directory:This is a key item. You need to specify a physical path for the new site.Independent and uniquesuch as
/app/dev_anqicms_com(usually in the Docker environment)/app/开头,并用域名替换点号为下划线)。EnglishQiCMS会在此目录下存储新站点的缓存、上传文件、模板等,确保文件层面的独立。 - Database name:It is equally important. Set up a login credential for the new siteUniqueThe database name, for example
dev_anqicms_com.AnQiCMS will store all the content and configuration data of the new site in this independent database.Although it will reuse your main instance's database connection information (such as the database server address, username, and password), the data itself is completely isolated in different database instances. - Administrator account/password:Set up an independent backend login credential for the new site.
- Website address:Fill in the domain name of the new site, which needs to be pre-resolved to your server IP.
- Configure reverse proxy:After deploying multiple sites, external users need to access them through different domain names.Since there is only one AnQiCMS application instance running, you need to configure the reverse proxy function of Nginx, Apache, or the panel's built-in reverse proxy to route different domain requests to the same listening port of the AnQiCMS instance.
- For example, your main site
www.site1.comand the new sitewww.site2.comwill be redirected through reverse proxyhttp://127.0.0.1:8001(or the port actually listened to by AnQiCMS instance).AnQiCMS receives a request and automatically identifies which site it is based on the domain name, and loads the corresponding independent data and files.
- For example, your main site
The benefits of this method are that the management is centralized, the resource consumption is relatively low (only one AnQiCMS application process), but it can effectively utilize the isolation of the database and file system to achieve data independence.
策略二:独立部署多个AnQiCMS应用(高度隔离与灵活配置)
If you追求极致的隔离性,或者需要在不同站点上运行不同版本的AnQiCMS,又或是您的服务器资源充裕,那么为每个站点部署一个独立的AnQiCMS应用程序实例是更好的选择。
- Deploy AnQiCMS application multiple times:Deploy a separate AnQiCMS application independently and run it for each site in the plan.
- English installation package/Docker container:Each site has its own AnQiCMS binary file copy or an independent Docker container.
- Independent port configuration:Each application instance in its
config.jsonfile requires aUniquelistening port (for example, the first site uses 8001, the second uses 8002, and so on). - Independent database connection:for each AnQiCMS instance:
config.jsonshould be configured to connect to itsdedicated databaseThis means that each instance not only connects to different database names, but can also use different database user credentials (if higher isolation is needed). *