As an experienced CMS website operation personnel in an information security enterprise, I know that some common but critical issues during the system deployment process can lead to installation obstacles.Among the common problems encountered by new users are occupied ports and incorrect configuration of pseudo-static rules.Correctly identify and solve these problems is the basis for ensuring the smooth operation of AnQiCMS and giving full play to its content management advantages.
How to investigate and solve port occupation problems
When installing AnQiCMS, if you encounter a prompt indicating that the port is occupied, it usually means that the port (default is 8001) you are trying to use to start AnQiCMS is already being listened to by another application on the server.AnQiCMS as an independent Go language application needs to occupy the port specified by its runtime.
First, we need to confirm which process is using the port. In a Linux server environment, you can uselsofEnter the command to view the port usage. For example, to check port 8001, you can enter in the terminallsof -i:8001If the command returns a result, it will display the process ID (PID) and related information that occupies the port.
Once we find the PID of the process occupying the port, the next step is to terminate the process. Similarly, in the Linux environment, you can usekill -9 PIDCommand to force terminate the process. For example, if the PID is 7621, you will executekill -9 7621After the process is terminated, AnQiCMS can successfully bind and use the port to start.
For users deploying AnQiCMS through Docker or panel tools (such as Baota Panel, 1Panel, aaPanel), the configuration and conflict handling of the port is slightly different.In these environments, you usually specify a 'container port' (the port that AnQiCMS actually listens to, usually 8001) and a 'server port' or 'host port' when creating a container or adding a Go project.If the host port is occupied, you just need to modify this host port to a new port that is not occupied, without concerning about the port inside the container.For example, when adding a Go project in the Baota panel, the project port can be changed to an unoccupied port such as 8002, 8003, and so on.The benefit of this approach is that even when deploying multiple AnQiCMS instances on a single server, each instance can be mapped to a different host port, thereby running without interference.
The incorrect handling method of pseudo-static rules.
The pseudostatic rules are an important part of web applications, which can convert dynamic URLs into more aesthetic and SEO-friendly static URLs.AnQiCMS has good built-in support for pseudo-static, but incorrect configuration at the web server level can cause the website pages to display 404 errors or style loading exceptions.
Configure the rule of pseudo-static mainly depends on the type of web server you use, common ones are Nginx and Apache.
For Nginx servers, the correct pseudo-static configuration is crucial. First, you need to make sure that the website's 'runtime directory' (known as 'website directory' in Baota panel) is correctly set to the AnQiCMS deployment directory underpublicfolder. thispublicThe directory contains all the static files that need to be directly exposed to the web server, such as CSS, JS, images, and the entry points used by AnQiCMS to process requests.
Next, in the Nginx configuration file (usually the one corresponding to the site's.confFile, or in the "URL Rewrite" settings of Baota panel), you need to add specific rewrite rules. An example of a typical Nginx rewrite rule is as follows:
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;
}
The logic of this configuration is: when a user's request arrives at Nginx,location /the command will first try to find out if the requested file or directory exists inpublicthe directory (try_files $uri $uri/index.htmlIf not found, forward the request to the AnQiCMS application@AnqiCMS)proxy_pass http://127.0.0.1:8001;The command is responsible for proxying the request to the local port that AnQiCMS is listening on.error_page 404 =200 @AnqiCMS;Ensure that even if Nginx handles requests as 404, AnQiCMS can also handle them to achieve custom 404 pages or pseudo-static routing.After configuration is complete, be sure to restart the Nginx service to make the changes take effect.
If you are using an Apache server, the implementation of pseudo-static is slightly different, usually achieved through reverse proxy.In the Baota panel, if you have selected Apache as the web server, you can add a rule in the "reverse proxy" settings.http://127.0.0.1:8001。Apache will forward all requests to the AnQiCMS for this site. Make sure Apache'smod_proxymodule is enabled, which is necessary for the reverse proxy function.
Regardless of which web server is used, the core goal of the pseudo-static rules is to route all frontend requests correctly to the AnQiCMS application, while allowing the web server to directly provide static resources, thus achieving URL beautification and improving performance.After the configuration is complete, be sure to visit your website through the browser, test that the URLs for all pages and features are normal, and ensure that the pseudo-static rules have been correctly applied.
Summary
When deploying AnQiCMS, incorrect port occupation and pseudo-static rules are two common 'roadblocks'.By following the above detailed troubleshooting and resolution steps, including using system tools to check and manage ports, and configuring the correct pseudo-static rules according to the characteristics of Nginx or Apache, you will be able to successfully complete the installation of AnQiCMS and provide a stable, efficient running environment for your website.As a website operator, mastering these basic skills is essential, as they will help us better manage and optimize our Anqin CMS site.
Frequently Asked Questions (FAQ)
Q1: What should I do if the website page shows blank or CSS is messed up after AnQiCMS is installed?
A1:If the website page displays a blank page or messy styles, this is usually due to incorrect configuration of the pseudo-static rules or incorrect settings of the website running directory. Please first check whether the pseudo-static rules of the web server (Nginx/Apache) have been correctly configured according to the documentation, especially for Nginx'stry_filescommands andproxy_passtarget address, as well as the target address of Apache's reverse proxy. Next, confirm that the website's running directory points to the deployment path of AnQiCMS.publicfolder.If all these are correct, please try clearing your browser cache and the website CDN cache (if used).If the problem persists, check if the AnQiCMS program has started normally and is listening on the correct port, as well as whether the server firewall is blocking access to the AnQiCMS port.
Q2: How to safely upgrade AnQiCMS version?
A2:The recommended method for safely upgrading AnQiCMS is: first,Make sure to perform a complete backup of the database and all AnQiCMS files before upgrading.Then, log in to the AnQiCMS backend, navigate to the 'System Upgrade' feature, the system usually detects new versions and provides an online upgrade option.Follow the prompts to perform the upgrade operation.config.jsonHandle your customized template file with caution to avoid being overwritten, and finally restart the AnQiCMS process.After the upgrade, it is recommended to clear the system cache and check whether the website functions are normal.For users deploying through Docker, it is usually sufficient to update the Docker image.
Q3: How to reset if you forget the admin password of the background?
A3:If you forget the password for the AnQiCMS backend administrator, there is no direct "password recovery" feature available on the backend.You need to reset the password by directly modifying the database.The specific steps are as follows: Log in to your MySQL database management tool (such as phpMyAdmin, Navicat, or via command line).usersOr a table with a similar name. Find your administrator user record in this table, and change the password field (usuallypasswordorpasswd)Modify the MD5 value of the new password (or the hash value corresponding to the AnQiCMS backend encryption method, which may require referring to the latest AnQiCMS documentation or code).The simplest method is to create a new admin account, note down its default MD5 password, then log in to the backend with this new account, and then change the password of your original admin account.admin/123456), and change the password of the existing administrator immediately after logging in.