As an experienced CMS website operation personnel in the field of information security, I fully understand the importance of efficiently and stably deploying multiple application instances when managing and expanding the website.For a flexible and versatile system like AnQi CMS, many operators may have the need to deploy multiple sites or instances on a single server.When using modern server management tools such as 1Panel, port conflict is a common challenge.
Now, let's delve into how to effectively resolve port conflicts when installing multiple security CMS instances in the 1Panel environment, ensuring that each of your websites can run stably.
Understand the port mechanism of 1Panel and AnQi CMS
The AutoCMS is a system developed based on the Go language, which, by default, listens on a specific port (usually 8001) to provide services.When deploying multiple security CMS instances on the same server, if each instance attempts to use the same default port, it will lead to port occupation, resulting in a conflict and causing the subsequent instances to fail to start normally.
1Panel as a powerful server operation and maintenance management panel, provides an elegant solution - port mapping when deploying Docker containers. Applications within Docker containers usually listen to a fixed port, and Docker allows you to map this internal port of the container to a port on the host machine (server) whereUniqueThe port. In this way, even if all security CMS containers internally listen to port 8001, they can coexist harmoniously by mapping to different ports on the host.
Create and resolve port conflicts of the security CMS instance in 1Panel in English
The key to solving port conflicts is to assign a unique host port to each security CMS Docker container. The following are the specific steps:
Deploy the first AnQi CMS instance
Firstly, you can create the first AnQi CMS container in the 1Panel following the regular process.
In the "Container
- Enter the name you set for this instance in the "Name" field, for example
anqicms-site1. - In the "Mirror
anqicms/anqicms:latest. - In the "Port
8001. - Continue configuring other options, such as restart policy, and then click "Confirm" to complete the container creation.
After the container is created, you need to set up reverse proxy for this instance. In the 1Panel "Website
- In the "Primary Domain" field, enter the domain name corresponding to this instance, for example
site1.yourdomain.com. - Enter in the "Proxy Address" field
127.0.0.1:8001This indicates that requests from the domain will be forwarded to port 8001 on the host machine, which is being listened to by your first security CMS container. - Click “Confirm” to complete the site creation.
Access the domain, complete the initial installation of the first security CMS instance.
Deploy subsequent security CMS instances.
Deploying the second and more CMS instances is the core link to solve port conflicts.When you create the second security CMS container, repeat the steps to create the container above, but you need to make a key adjustment in the "port" setting.
- Set a different name for the new instance, for example.
anqicms-site2. - The mirror is still.
anqicms/anqicms:latest. - In the "PortThe "Container" port should still be filled in.
8001Because this is the port that the Safe CMS application listens on inside the container.However, the “server” port must be filled with a new port different from the existing instancefor example8002. - By analogy, if you want to deploy the third instance, the “server” port can be set to
8003Ensure that each instance has a unique host port accordingly.
Configure reverse proxy for each newly created security CMS container.
- In the 'Website' interface of 1Panel, click 'Create Website', and select 'Reverse Proxy'.
- Enter the domain name of the new instance in the 'Main Domain', for example,
site2.yourdomain.com. - In the "Proxy Address" field, fill in
127.0.0.1:YOUR_UNIQUE_HOST_PORT. For the second instance, it will be127.0.0.1:8002; For the third instance, it will be127.0.0.1:8003. - Click “Confirm” to complete the site creation.
Make good use of the multi-site management capabilities of Anqi CMS
It is worth mentioning that the AnQi CMS itself comes with powerful multi-site management features.After you have deployed multiple secure CMS instances using the above method, each instance is an independent secure CMS application.If your requirement is to manage multiple independent websites (such as sharing core code and some global configurations) within a secure CMS application, you can choose to deploy only one secure CMS main instance and then use its "multi-site management" feature to create and manage more websites.This method does not require deploying an independent Docker container for each website, but is managed and served by a secure CMS instance, which differentiates between sites through different databases and directories, and can still achieve multi-site operation.This is a different scenario and strategy from deploying multiple independent instances through Docker to resolve port conflicts.
Through the Docker containerization capability of 1Panel, combined with port mapping and reverse proxy, you can easily deploy and manage multiple safe CMS instances on a single server, avoiding port conflicts and providing a solid foundation for your website operation.
Frequently Asked Questions
1. Why does my second security CMS instance fail to start, prompting that the port is occupied?
2. What is the difference between container port and server port in 1Panel?
The 'Container Port' refers to the port that the Docker container's internal application (such as AnQi CMS) actually listens on, which is typically fixed at 8001 for the AnQi CMS Docker image.The 'server port' (or host port) is the port that your server exposes to the outside, which is mapped to the port inside the container.When an external request arrives at a port of the server, Docker forwards it to the corresponding internal port of the container.To avoid conflicts, the 'server port' of different security CMS containers must be unique, while their 'container port' can be the same.
3. Do I need to install an independent MySQL database for each security CMS instance?
When you deploy multiple security CMS containers through Docker in 1Panel, each container is typically regarded as an independent application instance.**Practice is to configure a separate database for each security CMS instance to ensure data isolation and manageability.You can install multiple MySQL containers in the 1Panel app store, or create multiple different databases within a single MySQL container, and specify the corresponding database name and credentials during the initialization installation process of each CMS instance.