aaPanel Docker Installation AnQiCMS Failed? Don't worry, manual reverse proxy can easily solve it!
Hello!As an experienced website operations expert, I know how important efficiency and stability are when deploying a website.AnQiCMS, with its high-performance architecture developed in Go language, rich and practical SEO features, and flexible content management capabilities, has become the preferred choice for many small and medium-sized enterprises and content operators.It is not only easy to deploy and has high running efficiency, but also can effectively ensure website security.
However, automation deployment tools are convenient, but occasionally they may encounter situations where they are not well-suited to a particular environment.When we eagerly use Docker to one-click install AnQiCMS in aaPanel, and find that the website cannot be accessed normally, we often feel a bit frustrated.Don't worry, this is usually not a problem with AnQiCMS itself, but the automatic reverse proxy configuration of aaPanel may not have been successfully applied.Today, I will teach you step by step how to easily solve this problem by manually configuring reverse proxy, so that your AnQiCMS website can go online quickly!
Why does the automatic deployment occasionally 'fail'?
aaPanel integrated Docker and reverse proxy features, aiming to simplify the deployment process.But in actual operation, due to various factors such as server environment, network configuration, resource limitations (such as insufficient memory causing Docker container startup exceptions, or instantaneous communication failures between internal modules of aaPanel), it may cause the automatically created reverse proxy rules to fail to correctly point to the AnQiCMS Docker container.8001),but external access is not reachable, manually intervening in the configuration of reverse proxy becomes the most direct and effective solution.
Solution: Manually configure reverse proxy
After you find that the AnQiCMS website cannot be accessed after installing it through aaPanel's Docker, please follow the steps below:
第一步:确认 AnQiCMS Docker 容器运行状态
Firstly, we need to confirm whether the AnQiCMS Docker container has been successfully started and is running.
- Log in to your aaPanel dashboard.
- Click the "Container" menu on the left navigation bar.
- Find the container instance named
anqicms(or a container name you customize) in the "Container" page. - Check if the status displays as 'Running'.If the container is not running, please try to start it manually and check the log (Log) to find out the specific cause of the failure.If the container is indeed running normally, we can then proceed to configure the reverse proxy.
Step 2: Create or modify the website reverse proxy.
If the AnQiCMS container is running normally but the website still cannot be accessed through the domain name, we need to manually configure the reverse proxy.
- In the aaPanel left navigation bar, click the "Website" menu.
- If you have previously installed AnQiCMS through the Docker application of aaPanel, the system has automatically created a website. You can click the "Settings" button corresponding to the website to enter the configuration interface.If not, or you wish to recreate, you can click the "Add Site" or "Reverse Proxy" option to create a new site.
- In the site settings interface or the add site wizard, select "Reverse Proxy" as the website type.
- Main Domain:Enter the domain name you wish to access AnQiCMS, for example
your-domain.comortest.anqicms.com. Make sure that the domain has been correctly resolved to your server's IP address. - 目标 URL:这是最关键的配置项。请将其设置为
http://127.0.0.1:8001.127.0.0.1表示本地回环地址,确保请求在服务器内部流转,而不是试图向外部网络发送。8001is the port exposed by the AnQiCMS Docker container by default.If you modified the port during installation (for example, to run multiple AnQiCMS instances on the same server), please make sure to enter the actual port you are using.
Third step: Manually configure the Nginx configuration file (recommended)
Although aaPanel will try to generate the Nginx configuration according to your settings, in order to ensure everything is secure and for better control, we strongly recommend that you manually check and modify the Nginx configuration file.
In the "Settings" tab of the website you have set up (or a new reverse proxy site you have created).
You will see an Nginx configuration file editing box. We need to add or modify the reverse proxy rules required by AnQiCMS. Find
servercode block, usually it containslisten/server_namesuch instructions.In
serverwithin the code block, find or add a configuration segment like the following Nginx configuration:location @AnqiCMS { proxy_pass http://127.0.0.1:8001; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 =200 @AnqiCMS; location / { try_files $uri $uri/index.html @AnqiCMS; }Here, I will explain simply the function of this configuration:
location @AnqiCMS { ... }:defined a namedAnqiCMSinternal Location block.proxy_pass http://127.0.0.1:8001;This is the core instruction, it tells Nginx to forward all requests matching this Location to the internal server127.0.0.1:8001The address, that is, the address that AnQiCMS container listens to.proxy_set_header ...These instructions are used to pass the client's real IP and hostname information to the AnQiCMS application to ensure it can correctly obtain the visitor's information.
error_page 404 =200 @AnqiCMS;This configuration line is a clever trick. When Nginx cannot find the requested static file (returns a 404 error), it internally redirects to@AnqiCMSThis Location block is equivalent to forwarding unfindable requests to AnQiCMS for processing, allowing AnQiCMS to decide how to respond.location / { ... }:This is the Location block that handles all root path requests.try_files $uri $uri/index.html @AnqiCMS;:This line of instruction tells Nginx to try in order:- Find the physical file matching the request URI (
$uri). - If the file does not exist, try to find the directory matching the URI (
index.html) file ($uri/index.html). - If both of the above are not found, the request will be forwarded to
@AnqiCMSThis internal Location block, which forwards to the AnQiCMS container for processing.The benefits of doing this are that static files (such as images, CSS, JS) can be directly provided by Nginx, improving efficiency, while dynamic content is handled by the AnQiCMS application.
- Find the physical file matching the request URI (
Save and restart Nginx:After configuration is complete, be sure to click the "Save" button, then go back to the aaPanel homepage, click the "Restart" button next to the Nginx service to make the new configuration take effect.
Fourth step: Visit your AnQiCMS website
Now, you can enter the domain name you set in your browser, for examplehttp://your-domain.com/。If everything goes well, you will see the AnQiCMS initial installation interface.
After the installation is complete, the backend access address of AnQiCMS is您的域名/system/。For example, if your website ishttp://test.anqicms.com/Then the background access path ishttp://test.anqicms.com/system/。The initial administrator account is usuallyadmin,the password is123456。After logging in, please change the default password to ensure the security of your website.
Summary
Although the Docker automation deployment feature of aaPanel is powerful, understanding and manually configuring reverse proxy is the key to solving the problem when unexpected situations occur.Through these steps, you not only solved the deployment problems of AnQiCMS, but also deepened your understanding of how Docker containers and Web servers (Nginx) work together.This comprehensive guide is intended to help you smoothly set up and operate your AnQiCMS website!
Common Questions (FAQ)
- why can't I access directly
http://服务器IP:8001Access AnQiCMS?In most cases,8001Port may not be directly exposed to public network access, or restricted by server firewall (e.g., the firewall built into aaPanel, or the security group provided by the cloud service provider).In addition, directly accessing through IP and port is not conducive to search engine optimization (SEO), and it is also not possible to configure an SSL certificate for HTTPS access.80(HTTP) Or443(HTTPS) requests to the port, forwarded to the internal port of the AnQiCMS container based on the domain, while handling SSL certificates, hiding the backend service port, and other functions to provide a more secure, professional, and user-friendly environment.