In the AnQiCMS multi-site deployment tutorial, how is the PID of different sites distinguished and managed?
As an experienced security CMS website operation person, I am well aware of the great value of multi-site deployment in content management and efficiency improvement.For the question you raised about the AnQiCMS multi-site deployment tutorial, how are the PIDs of different sites distinguished and managed?This question, I will elaborate on the mechanism of Anqi CMS design and actual operation for you.
In the multi-site deployment scenario of AnQi CMS, distinguishing and managing the PID (Process ID, process ID) of different sites mainly depends on the deployment method you adopt.AnQi CMS provides two core multi-site deployment modes, and these two modes have significant differences in process management.
Multi-site deployment of an independent application instance
The first mode is to deploy an independent security CMS application instance for each site.Under this deployment method, each secure CMS instance runs independently on the server.Information mentioned in the "Frequently Asked Questions" section of the document: "Each AnQiCMS requires a port, the default port is 8001. If you want to install multiple AnQiCMS on the same server, you need to allocate a different port for each project, and the port is written in config.. Edit config. to define different ports.
This means that if you deploy three sites on the same server, for examplesiteA.com/siteB.comandsiteC.com:
- You will deploy three independent Aiqi CMS program files.
- Each program will be configured with an independent running port, for example
siteA.comrunning on8001port,siteB.comrunning on8002port,siteC.comrunning on8003on the port. - Each independently running AnQi CMS application instance will have one in the operating systemIndependent PID.
In this mode, the operating system will assign a unique PID to each secure CMS process.When managing these processes, you can manage them like any other standalone application, by finding and operating on their corresponding PIDs through their port numbers or executable file names.The document also mentions how to use it in the "Common Errors During Installation"}lsof -i:{端口号}To find the PID of the process occupying a specific port and to usekill -9 {PID}To terminate the process, these are all operation methods for independent processes.
Manage multiple sites within a single application instance
The second mode is also the multi-site management mode recommended and built-in by AnQi CMS, which is to host multiple sites through a single AnQi CMS application instance.This method is particularly suitable for Docker deployment in integrated environments such as Baota panel or 1Panel, or for configuring Nginx/Apache reverse proxy via the command line.The chapter "Adding a secure CMS multi-site tutorial through reverse proxy" and "installing multi-sites on a single server" in the document describes this method in detail.
In this mode:
- Only one security CMS core application is runningFor example, it may listen uniformly.
8001Port. Therefore, at the operating system level,There is only one secure CMS process, corresponding to a single PID. - All external requests, whether accessing
site1.com/site2.comOrsite3.comIt will first go through a reverse proxy server (such as Nginx or Apache). - The reverse proxy server forwards traffic to the unique security CMS application at the backend based on the domain name (Host header)
8001on the port. - The Anqi CMS application willdistinguish which site's request based on the domain name inside after receiving the requestIt determines the current site of the request by matching the request domain with the site information configured in the background "Multi-site Management" (including "site root directory" and "website address", etc.).
- Site data (such as content, cache, database) is typically stored independently, isolated through the 'site root directory' and 'database name' specified when creating a new site.
In short, in this mode, the distinction and management between different sites is not achieved through the PID at the operating system level, but through collaboration at the following two levels:
- External (Reverse Proxy Layer): Responsible for routing requests from different domain names to the same AnQi CMS application.
- Internal (AnQi CMS Application Layer): The application itself recognizes the domain of the request and dynamically loads and processes the resources and data of the corresponding site according to the preset configuration.
The advantage of this deployment method lies in higher resource utilization and more centralized management, but it requires the correct configuration of reverse proxy and the internal logic of the security CMS to effectively distinguish and isolate data from different sites.
In summary, the distinction and management of PID in the multi-site deployment of Anqi CMS is a problem that varies according to the specific deployment strategy.Each independently deployed AnQi CMS instance has its own PID, while managing multiple sites through a single AnQi CMS application, all sites share the same PID of the AnQi CMS core process, and the distinction and management between sites are completed within the application and the reverse proxy layer.
Frequently Asked Questions
Q1: When managing multiple sites with a single secure CMS instance, will a failure in one site affect the others?A1: Yes, since all sites share the same safe CMS core application process, if this process crashes due to abnormal operation or code error of a site, it is theoretically affecting all sites hosted under this instance.To mitigate this risk, an enterprise CMS usually has a robust error handling mechanism, but the practice typically includes regular backups and monitoring, and considering the deployment mode based on business importance.
Q2: How to configure different runtime environments or Go program versions for different sites in the multi-site mode of a single security CMS instance?A2: In a single security CMS instance mode, all sites run on the same Go program version and the running environment it is in.If you need to use different versions of the Go program, independent Go environment configurations, or independent upgrades for different sites, you should adopt the 'multi-site deployment of independent application instances' mode, that is, deploy an independent AnQiCMS application for each site.
Q3: How does AnQi CMS ensure data isolation and security for different sites in the single instance multi-site mode?A3: The Anqi CMS ensures data isolation through clear site configuration.When adding a new site in the background, the system will require an independent "site root directory" and "database name" for each site.This means that the data storage (such as cache, uploaded files) and content database of each site are independent of each other.In addition, the permission management system will also make detailed divisions for administrators of each site, ensuring that administrators of different sites can only access and manage the data of their respective sites.