As a senior CMS website operation personnel of AnQi, I am well aware of the importance of efficiently and stably deploying multiple application instances when managing and expanding a website.For an Anqi CMS system as flexible and versatile as this, many operators will have the need to deploy multiple sites or multiple instances on a single server.When using modern server management tools like 1Panel, port conflicts are a common challenge.

Now, let's delve into how to effectively resolve port conflict issues when installing multiple secure CMS instances in the 1Panel environment, ensuring that every website can run stably.

Understand the port mechanism of 1Panel and AnQi CMS

The AnQi CMS is a system developed based on the Go language, which listens on a specific port (usually 8001) by default to provide services.When you deploy multiple AnQi CMS instances on the same server, if each instance tries to use the same default port, it will lead to port occupation, causing a conflict and making it impossible for subsequent instances to start normally.

1Panel is a powerful server operation and maintenance management panel that provides an elegant solution - port mapping when deploying Docker containers. Applications inside Docker containers usually listen on a fixed port, and Docker allows you to map this internal port of the container to a port on the host machine (server)Uniqueport. This way, even if all the aSecurity CMS containers inside listen to port 8001, they can coexist peacefully by mapping to different ports on the host.

Create and resolve port conflict of the AnQi CMS instance in 1Panel

The key to resolving port conflicts is to assign a unique host port to each secure CMS Docker container. Here are the specific steps:

Deploy the first A safe CMS instance

Firstly, you can create the first A safe CMS container following the standard process in 1Panel.

In the 'Container' interface of 1Panel, select the 'Container' Tab and click 'Create Container'.

  • Enter the name you set for this instance in the 'Name' field, for exampleanqicms-site1.
  • In the "Image" section, select "Manual input" and fill inanqicms/anqicms:latest.
  • In the "Port" settings, select "Expose Port" and fill in the "Server" and "Container" ports with the default values8001.
  • Continue configuring other options, such as restart policies, and then click “Confirm” to complete container creation.

After the container is created, you need to set up reverse proxy for this instance. In the 1Panel's "Website" interface, click "Create Website", select "Reverse Proxy".

  • Enter the domain name corresponding to this instance in the "Main Domain" field, for examplesite1.yourdomain.com.
  • Enter in the "Proxy Address" field127.0.0.1:8001This indicates that requests from the domain are 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 and complete the initialization installation of the first security CMS instance.

Deploy subsequent security CMS instances.

Deploying the second and more Aqei CMS instances is the core link to solve port conflicts.When you create the second AnQi CMS container, repeat the steps to create the container above, but make a key adjustment in the "port" settings.

  • Set a different name for the new instance, for example.anqicms-site2.
  • The image is still.anqicms/anqicms:latest.
  • In the "Port" settings, select "Expose Port".The "Container" port should still be filled.8001This is the port that the AnQi CMS application listens on internally within the container.However, the 'server' port must be filled in with a new port different from the existing instanceFor example8002.
  • By analogy, if you are to deploy the third instance, then the 'server' port can be set to8003As for the rest, make sure each instance has a unique host port.

Configure reverse proxy for each newly created Aqie 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 "Primary Domain", for examplesite2.yourdomain.com.
  • Enter in the "Proxy Address"127.0.0.1:YOUR_UNIQUE_HOST_PORTFor the second instance, it will be127.0.0.1:8002For the third instance, it will be127.0.0.1:8003.
  • Click “Confirm” to complete the site creation.

Repeat the above steps for each new instance, ensuring that each has an independent Docker container, mapped to a unique host port, and accessed through its own reverse proxy service.After setting up the reverse proxy, access the corresponding domain, and initialize the installation for each safe CMS instance.

Make good use of the multi-site management capabilities of AnQi CMS

It is worth mentioning that AnQi CMS itself is built with powerful multi-site management features.After you deploy multiple AnQi CMS instances using the above method, each instance is an independent AnQi CMS application.If your requirement is to manage multiple independent websites within a secure CMS application (for example, sharing core code and some global configurations), 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 instead, it is managed and served by a secure CMS instance, which distinguishes different sites through different databases and directories, and can also achieve multi-site operation.This is different from deploying multiple independent instances through Docker to resolve port conflicts.

By using 1Panel's Docker containerization capabilities, combined with port mapping and reverse proxy, you can easily deploy and manage multiple secure CMS instances on a single server, avoiding port conflicts and providing a solid foundation for your website operations.


Frequently Asked Questions

1. Why did my second AnQi CMS instance fail to start, indicating that the port is occupied?

This is usually because you did not allocate a different host port for the second Docker container that you created.Although the security CMS inside the Docker container may all listen to port 8001, each port on the host machine can only be occupied by one process.You need to set the server port of the second instance to 8002, for example, when creating containers in 1Panel, instead of the default 8001.

2. What is the difference between container port and server port in 1Panel?

“Container port” refers to the port that the Docker container's internal application (such as AnyCMS) actually listens to. For the AnyCMS Docker image, it is usually fixed at 8001.And the 'server port' (or host port) is the port 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 will forward it to the corresponding internal port of the container.In order to avoid conflicts, the 'server port' of different 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 Anqi CMS instance?

When you deploy multiple AnQi CMS containers through Docker on 1Panel, each container is usually considered as an independent application instance.**Practice is to configure a separate database for each Anqi CMS instance to ensure data isolation and management convenience.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 for each secure CMS instance.