How to configure reverse proxy through 1Panel when installing AnQiCMS with Docker?
An QiCMS, as an enterprise-level content management system developed based on the Go language, is an ideal choice for small and medium-sized enterprises and content operation teams with its high efficiency, security, and ease of use.Combine 1Panel, a convenient server management panel, and deploy AnQiCMS containerized by Docker to greatly simplify the installation and maintenance process.To enable AnQiCMS to access through a custom domain and hide its internal running port, configuring reverse proxy is an essential step before the website goes into operation.This guide will detail how to configure reverse proxy for AnQiCMS deployed in the 1Panel environment.
Before starting the configuration, please make sure that your server has successfully installed the 1Panel management panel.1Panel provides a convenient app store, you need to install OpenResty (as a web server) and MySQL (as a database service), both of which are essential for AnQiCMS to run.If 1Panel has not been installed yet, please refer to its official documentation to complete the installation.
Deploy AnQiCMS Docker container
In the 1Panel management interface, navigate to the "Container" section of the left menu, select the "Container" tab, and then click the "Create Container" button. In the pop-up configuration interface, name the container, for exampleanqicmsIn the "Mirror" option, select "Manual input" and then enter in the input boxanqicms/anqicms:latest.
Regarding port configuration, select 'Expose Port' and set both 'Server Port' and 'Container Port' to8001. It is important to note that if you plan to run multiple AnQiCMS instances on the same server, each instance's 'server port' should be set to a different, unused value (such as8002/8003),but the corresponding “container port” should still be8001,because this is the service listening port inside the AnQiCMS container.
Continue scrolling down, at the 'Restart Strategy' section, it is recommended to select 'Restart after failure' or 'Restart if not manually stopped', to ensure that the service can recover automatically after abnormal exit.After completing the above configuration, click the "Confirm" button to create and start the AnQiCMS container.
Configure AnQiCMS reverse proxy site
Successfully created AnQiCMS container, next you need to configure reverse proxy in 1Panel to access it through the domain name you have set up.In the left menu of 1Panel, click the 'Website' option, select the 'Website' tab, and then click the 'Create Website' button.
In the pop-up interface, select the 'Reverse Proxy' type. In the 'Primary Domain' field, enter the domain name you wish to use to access AnQiCMS, for exampletest.anqicms.comEnsure that this domain name is correctly resolved to your server IP address. In the 'Proxy Address' field, fill in127.0.0.1:8001. Here127.0.0.1Represents the local loopback address of the server, and8001It is the 'server port' exposed to the outside when you create a Docker container.If you have previously set different server ports for multiple AnQiCMS containers, please make sure that the port you enter here matches the actual 'server port' of the AnQiCMS container you want to proxy.Finally, click the "Confirm" button to complete the creation of the reverse proxy site.
Complete the initialization installation of AnQiCMS
After the reverse proxy configuration is complete, you can access the domain you set via your browser, for examplehttp://test.anqicms.com/At this time, AnQiCMS will guide you to the initialization installation interface.Fill in the database information as prompted (make sure it matches the MySQL configuration you installed in the 1Panel app store), set up the admin account and password, and confirm the website address.After completing these steps, AnQiCMS can run normally.The backend management address of AnQiCMS is usually added to your domain name/system/For examplehttp://test.anqicms.com/system/. Please make sure to properly store your backend account information.
By combining 1Panel with Docker to deploy AnQiCMS and configure reverse proxy, it not only simplifies the technology stack and improves deployment efficiency, but also provides a unified entry and basic security protection for the host.This deployment method allows website operators to focus more on content creation and business development, without delving into complex server configurations.
Frequently Asked Questions (FAQ)
Question: Why do I need to configure a reverse proxy?
Answer: Configuring a reverse proxy allows you to access it through a custom domain (for exampleyourdomain.com) rather than IP address and port (for example192.168.1.1:8001Visit AnQiCMS. This not only improves user experience and makes the website address more professional, but also can hide the internal service port to some extent, increase security, and lay a foundation for advanced features such as HTTPS configuration, load balancing, and CDN acceleration in the future.
Question: How to configure reverse proxy if I install multiple AnQiCMS containers?
Answer: When you install multiple AnQiCMS Docker containers, each container needs to expose a unique 'server port' in 1Panel (for example,8001,8002,8003), and the internal port of the container is usually maintained as8001. When configuring reverse proxy in 1Panel, you need to create a separate website for each AnQiCMS instance and make sure that the "proxy address" of each website points to the corresponding "server port" of the instance (for example127.0.0.1:8001Corresponding to the first instance,127.0.0.1:8002At the same time, using different main domains or subdomains to distinguish access.
Ask: After configuring the reverse proxy, how should I troubleshoot if the website access fails?
Answer: First, check if your domain resolution is correctly pointing to the server IP.Next, confirm that the AnQiCMS Docker container is running normally in 1Panel, and you can check the status and logs through the container management interface of 1Panel.Then, check if the 'proxy address' port in the reverse proxy configuration is consistent with the 'server port' exposed by the Docker container.At the same time, check whether the server firewall (including the firewall settings of 1Panel itself and the security group rules of the cloud service provider) allows external access80⁄443Port, as well as the ports exposed by the container. Finally, you can check the website logs and container logs of 1Panel, which usually provide detailed error information to help you diagnose the problem.