Using Docker to deploy AnQiCMS multi-site: The way to solve port conflicts
AnQiCMS is an enterprise-level content management system developed based on the Go programming language, with its high efficiency, customizability, and easy scalability, it is very suitable for small and medium-sized enterprises and self-media operation teams to manage multiple sites.When deploying AnQiCMS multi-site in Docker environment, we mainly encounter two modes: one is to use the built-in multi-site management function of AnQiCMS, which carries multiple websites through a single AnQiCMS instance; the other is to deploy multiple independent AnQiCMS Docker containers, with each container serving one or a group of websites.These two modes have different focuses in solving port conflicts.
Understanding AnQiCMS multi-site management mode
AnQiCMS built-in powerful multi-site management function, this means that youNo need to deploy an independent AnQiCMS application for each site.An AnQiCMS system can be configured through the backend to manage multiple websites with independent domains, independent databases, and independent content structures.This pattern greatly saves server resources, reduces operation and maintenance costs, and simplifies the management process.AnQiCMS Docker containerThen, use an external reverse proxy (such as Nginx or OpenResty) to route requests from different domain names to this single Docker container.
In this "one AnQiCMS container manages multiple sites" mode, the core AnQiCMS service only occupies the Docker container inside8001Port, and map it to a specific port on the host machine (for example, the same8001). All requests from different domain names coming through the reverse proxy will eventually be forwarded to the host machine,8001Port, and then received by the AnQiCMS instance inside the Docker container. AnQiCMS will process the request according to theHostThe (domain name) is used to identify which site and display the corresponding content.
Under this deployment method, the AnQiCMS service itself only occupies one port on the host machine (for example8001),thereforeAnQiCMS instances will not have port conflicts。If the host machine's8001port is occupied by other services, what you need to do is:
- Modify the host port mapping of the Docker containerWhen starting the AnQiCMS Docker container, map the
8001port to the host port one above未被占用的端口,例如8002。命令类似docker run -p 8002:8001 anqicms/anqicms:latest. - 调整反向代理配置:确保Nginx或OpenResty等反向代理的
proxy_passThe instruction points to the actual port mapped by the AnQiCMS container on the host machine (for examplehttp://127.0.0.1:8002).
Deploy multiple AnQiCMS Docker containers: an independent and isolated multi-site solution
In scenarios where there is a high requirement for site isolation, or where each site is expected to have a completely independent runtime environment, upgrade cycle, and resource quota, we may choose to deploy a separate Docker container for each AnQiCMS site.Although AnQiCMS itself supports multiple sites, the Docker multi-container strategy provides stronger isolation.
In this "multiple AnQiCMS Docker containers" mode, resolving port conflicts becomes more direct and critical. Each AnQiCMS Docker container still listens to the default port `8