As a senior CMS website operation personnel of an enterprise security company, I fully understand the importance of efficient deployment and stable operation for any content management system.In the modern web environment, Docker container deployment is favored for its convenience, isolation, and portability.The AnQi CMS combined with Docker can provide you with a powerful and flexible content management platform.This article will elaborate on how to set port mapping and reverse proxy for AnQiCMS Docker container under Panel environment, ensuring that your website can be accessed smoothly.
Deploy AnQiCMS Docker container and port mapping
In the Panel environment (such as 1Panel or aaPanel), deploying the AnQiCMS Docker container is the first step to start the website.The core of this process lies in correctly mapping the service port inside the container to the port on the host.AnQiCMS listens on port 8001 by default inside a Docker container.
First, you need to access your Panel interface and find the 'Container' or 'Docker' management module.Here, you will usually find an option to 'create a container' or 'add a container'.
Container name can be set freely according to your preference, for example “anqicms-instance-1”. In the “Image” or “Image” option, you need to manually enter the official Docker image name of AnQiCMS, that isanqicms/anqicms:latest.
The next is the crucial 'port mapping' setting.The panel interface usually provides options such as "Expose ports" or similar.Here, you need to specify two ports: Host Port and Container Port.8001.
Host port, this is the open port on your server. If you are running only one AnQiCMS instance, you can fill it in directly8001If you plan to run multiple AnQiCMS instances on the same server, each instance needs a unique host port, for example8002/8003to avoid port conflicts.
After completing the port mapping setup, it is usually necessary to configure the container's restart policy, such as selecting 'restart after failure' or 'restart if not manually stopped', to ensure that the service can automatically recover in case of an unexpected interruption.Finally, confirm and create the container, waiting for Docker to complete the download of the image and the startup of the container.
Configure reverse proxy to access AnQiCMS via domain
After the AnQiCMS Docker container is started and port mapping is completed, you can access it through服务器IP:宿主机端口Access directly in the way.However, in order to provide user-friendly access methods and implement more advanced features (such as SSL encryption, multi-domain management), we usually configure reverse proxies.The reverse proxy forwards the user's domain request to the internal Docker container port.
In the Panel, you need to go to the 'Website' or 'Web Service' management module, select 'Create Website' and choose the 'Reverse Proxy' type. Here, you need to configure the following information:
Enter the domain name you have prepared for the AnQiCMS website, for exampleyourdomain.comorcms.yourdomain.comMake sure that the domain name has been correctly resolved to your server IP address.
The 'Proxy Address' or 'Target Address' field is crucial for reverse proxy, it tells the web server where to forward the request. Here you need to fill in127.0.0.1:宿主机端口. Among them,127.0.0.1refers to your local server address, and宿主机端口It is the host port that you map for the AnQiCMS Docker container when deploying (for example, if you are mapping8001, here you fill in127.0.0.1:8001)
If you run multiple AnQiCMS Docker containers on the same server and each container maps to a different host port (for example8001/8002Then you can configure a separate reverse proxy for each container, directing different domains to different127.0.0.1:宿主机端口to achieve the deployment of multiple AnQiCMS websites.
After completing these configurations, save and create the website. Panel will automatically configure reverse proxy rules for Nginx or OpenResty and other web servers.
Website initialization and management
After the reverse proxy is configured, you can enter the domain you have configured in the browser to access the AnQiCMS initialization installation interface.Complete database connection, admin account setup, and other steps according to the prompt, and your AnQiCMS website will run normally.
The backend management address of Anqi CMS is usually您的域名/system/. For example, if your domain name isyourdomain.com, then the backend access path will beyourdomain.com/system/.When logging in for the first time, please change the default administrator account and password to ensure website security.Deploy and manage AnQiCMS Docker container and reverse proxy via Panel, greatly simplifying the deployment process, allowing you to focus more on content creation and website operations.
Frequently Asked Questions
Q1: When I try to access my domain, the AnQiCMS website cannot be opened, showing "502 Bad Gateway" or connection error, how can I troubleshoot?A1: This usually means that the reverse proxy failed to connect to the AnQiCMS Docker container.You should first check if the Docker container is running, you can view its status through the container management interface of Panel.If the container is not running, please try to start it and check the logs for error information.Next, confirm that the "proxy address" in the reverse proxy settings matches the "host port" of the Docker container, and that this port is not occupied by other services on the server.Finally, check the server firewall settings to ensure that the host port allows traffic through.
Q2: How should I configure if I want to run multiple AnQiCMS websites on the same server, each using a different domain?A2: To deploy multiple AnQiCMS websites, you need to deploy an independent AnQiCMS Docker container for each website.Each container should be mapped to a different, unused port on the host machine at creation time (for example, the first container maps to 8001, the second container maps to 8002, and so on).127.0.0.1:宿主机端口For example,domain1.comPoint to127.0.0.1:8001,domain2.comPoint to127.0.0.1:8002.
Q3: What is the difference between the multi-site management feature provided by AnQiCMS backend and the aforementioned multiple Docker container deployment method?A3: The "Multi-site Management" feature of the AnQiCMS backend allows you to manage aa singleAnQiCMS application instance manages multiple independent logical sites.This means you only need to run one AnQiCMS Docker container, but through the background configuration, it can display different contents and templates based on different domain names.multipleAn independent AnQiCMS application instance, each instance is completely isolated from the others, with its own database and configuration, more suitable for those with higher requirements for isolation or teams that operate multiple projects independently.Generally, if you need to run multiple independent CMS, you would choose multiple Docker containers; if you want to manage multiple related websites in the same CMS, you would choose the built-in multi-site feature of AnQiCMS.