aaPanel Docker installation AnQiCMS failed? Don't worry, manually set up reverse proxy easily!
Hello! As an experienced website operations expert, I know how important efficiency and stability are when deploying a website.AnQiCMS leverages its high-performance architecture developed in Go language, rich and practical SEO features, and flexible content management capabilities, and has become the preferred choice for many small and medium-sized enterprises and content operators.It is not only easy to deploy and efficient in operation, but also can effectively ensure website security.
However, while automation deployment tools are convenient, they occasionally encounter situations where they do not fit well.When we eagerly use Docker to install AnQiCMS with one click in aaPanel, only to 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 rather the automatic reverse proxy configuration of aaPanel may not have been successfully activated.Today, I will teach you step by step how to manually configure reverse proxy to easily solve this problem and quickly launch your AnQiCMS website!
Why does the automatic deployment occasionally 'fail'?
The aaPanel integrates Docker and reverse proxy features, aiming to simplify the deployment process.In practice, due to various factors such as server environment, network configuration, and resource limitations (such as insufficient memory causing Docker container startup exceptions, or instantaneous communication failures between internal modules of aaPanel), it may result in the automatically created reverse proxy rules not correctly pointing to the AnQiCMS Docker container.When the AnQiCMS container has started normally and is listening on a certain internal port (such as the default one,8001But when external access cannot reach, manually intervening to configure a reverse proxy becomes the most direct and effective solution.
The solution: manually configure a reverse proxy.
After you find that the AnQiCMS website cannot be accessed through the Docker installation of aaPanel, please follow the steps below:
Step 1: Confirm the running status of the AnQiCMS Docker container
Firstly, we need to confirm that the AnQiCMS Docker container has started successfully and is running.
- Log in to your aaPanel dashboard.
- Click the 'Container' menu on the left navigation bar.
- On the 'Container' page, find the named
anqicms(or a container name you customize) container instance. - Check if its status is displayed as 'Running'.If the container is not running, please try to start it manually and check the log (Log) for the specific cause of the failure.If the container is indeed running normally, we can proceed to configure the reverse proxy.
Step two: 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, then we need to manually configure reverse proxy.
- In the left navigation bar of aaPanel, click the 'Website' menu.
- If you have previously installed AnQiCMS through the aaPanel Docker application, the system has automatically created a website, and you can click the "Settings" button corresponding to the website to enter the configuration interface.If none, 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 site addition wizard, select 'Reverse Proxy' as the website type.
- Primary Domain:Enter the domain name you wish to access AnQiCMS, for example
your-domain.comortest.anqicms.comMake sure that the domain name has been correctly resolved to the IP address of your server. - Target URL:This is the most critical configuration item. Please set it to
http://127.0.0.1:8001.127.0.0.1Represents the local loopback address, ensuring that requests are routed internally within the server rather than attempting to send them to external networks.8001Is the default port exposed to the outside by the AnQiCMS Docker container.If you modified the port during installation (for example, to run multiple AnQiCMS instances on the same server), make sure to fill in the actual port you are using.
The third step: Manually configure the Nginx configuration file (recommended)
Although aaPanel will try to generate Nginx configuration based on your settings, we strongly recommend that you manually check and modify the Nginx configuration file to ensure that everything is in place and for finer control.
In the 'Settings' tab of the website you have set up (or a newly created reverse proxy site).
You will see an Nginx configuration file editing box. We need to add or modify the reverse proxy rules required by AnQiCMS. Find
servercode blocks, which usually containlisten/server_namecommands.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 the function of this configuration briefly:
location @AnqiCMS { ... }: Defined a namedAnqiCMSThe internal 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, which is the address that the AnQiCMS container listens to.proxy_set_header ...These instructions are used to pass the real IP and hostname information of the client to the AnQiCMS application to ensure it can correctly obtain the visitor's information.
error_page 404 =200 @AnqiCMS;This line of configuration is a clever trick. When Nginx cannot find the requested static file (returns a 404 error), it will internally redirect to@AnqiCMSThis Location block is equivalent to forwarding the unfound request 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 that it will try in sequence:- Locate the physical file matching the request URI (
$uri) - If the file does not exist, then try to locate the directory matching the URI under (
index.htmlthe file ($uri/index.html) - If both of the above are not found, the request will be forwarded to
@AnqiCMSThis is the internal Location block, which is forwarded to the AnQiCMS container for processing.The benefit of doing this is that static files (such as images, CSS, JS) can be provided directly by Nginx, improving efficiency, while dynamic content is handled by the AnQiCMS application.
- Locate the physical file matching the request URI (
Save and restart Nginx:After the configuration is completed, 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.
Step 4: Visit your AnQiCMS website
Now, you can enter the domain name you have set, for examplehttp://your-domain.com/. If everything goes well, you will see the AnQiCMS initial installation interface.
After the installation is complete, the background access address of AnQiCMS is您的域名/system/For example, if your website ishttp://test.anqicms.com/then the back-end access path ishttp://test.anqicms.com/system/. The initial administrator account is usuallyadmin, and the password is123456. After logging in, please change the default password to ensure website security.
Summary
Although the Docker automation deployment feature of aaPanel is powerful, understanding and manually configuring the reverse proxy is the key to solving problems when unexpected situations occur.By following 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.Hope this comprehensive guide can help you successfully build and operate your AnQiCMS website!
Frequently Asked Questions (FAQ)
- Why can't I pass directly
http://服务器IP:8001Visit AnQiCMS?Generally speaking,8001The port may not be directly exposed to public network access or limited by the server firewall (such as the built-in firewall of aaPanel or the security group of the cloud service provider).In addition, accessing directly using IP and port is not convenient for search engine optimization (SEO), and it is also not possible to configure an SSL certificate for HTTPS access.The role of reverse proxy is to standardize80(HTTP) or443Requests for (HTTPS) ports, forwarding to the internal port of the AnQiCMS container based on the domain, while handling SSL certificates, hiding the backend service port, and other functions, thus providing a safer, more professional, and more advantageous environment.