As an experienced website operations expert, I am well aware of the anxiety of being unable to access the website backend.AnQiCMS (AnQiCMS) with its efficient features of Go language and concise architecture, has brought us great convenience.However, even the most excellent system may encounter 'little插曲' when starting up.When the AnQiCMS program fails to start, causing the background to be inaccessible, how can we systematically troubleshoot errors and quickly restore the website to normal?Don't panic, let's take it step by step, as accurately as a surgeon, to locate the problem.
How can we troubleshoot errors when the AnQiCMS background cannot be accessed?
The backend is inaccessible, usually indicating that the frontend service has failed, or the backend management interface (/system/The path cannot be loaded normally. To troubleshoot such issues, we need to conduct a series of checks from the system level to the application level.
Step 1: Preliminary diagnosis, quickly locate the problem.
Before we delve into a thorough check, we first do some basic quick diagnostics to rule out common and easily solvable problems.
First, you need toconfirm the status of the server itself..Connect to your server via SSH or Remote Desktop, check if the server is running normally, and if the network is畅通.If the server cannot be connected, the problem may be due to server hardware, network provider, or the basic operating system level, the failure of AnQiCMS is just the tip of the iceberg.
Next, we need to confirmIs the core program of AnQiCMS actively running on the server. AnQiCMS is a system developed in Go language and is usually compiled into an independent binary file (for exampleanqicms). Under Linux, you can executeps aux | grep anqicmsCommand to check if there are any related processes. If the command returns empty, or does not display the expected results.anqicmsProcess, then it is obvious that the program has not started at all. At this time, you can try to manually execute its startup script (such as./start.shIf your deployment method provides it, observe whether there are any error messages output directly to the terminal.If the program is indeed not running and you are using tools such as Baota Panel or 1Panel, please check the running status of the AnQiCMS application in the panel and try to restart it.
If the program shows that it is running but is still inaccessible in the background, we need to checkPort occupation and firewall。AnQiCMS listens on port 8001 by default. You can uselsof -i:8001Command (under Linux) to check if port 8001 is occupied by other processes.If a process is found to be using the port and not AnQiCMS, this is likely one of the reasons why AnQiCMS cannot start.kill -9 PID(Replace PID with the process ID using the port to terminate the conflicting process and then restart AnQiCMS. Also, don't forget to check the firewall settings of the server, whether it is the one built into the operating system (such asufworfirewalldWhether it is the security group rules provided by the cloud service provider or the security group rules you need to ensure that the 8001 port (or the AnQiCMS listening port you define) and the 80/443 ports (if you use a reverse proxy) are open to the outside.
The second step: delve into the root cause and break it down step by step
If the preliminary diagnosis does not solve the problem or new clues are found, we need to investigate potential deeper level problems.
AnQiCMS configuration checkIt is a critical step. The configuration information of AnQiCMS is usually stored in the root directory of the program.config.jsonfile. Please check this file carefully, especiallyportParameters, make sure it matches the port number you expect.If the program reads the wrong port configuration when it starts, you will not be able to access it through the correct address even if the program runs.db_host/db_port/db_user/db_pass/db_name) It is also in this file, we will check the database issues later.
Database connection issueIs the most common 'bottleneck' in the CMS system.AnQiCMS depends on MySQL database to store all content and configurations.systemctl status mysqlCheck). Then, try usingmysql -h <db_host> -P <db_port> -u <db_user> -p<db_pass>Command, manually connect to the database and try to execute some simple queries, such asSHOW DATABASES;to verifyconfig.jsonAre the database credentials correct and do they have sufficient permissions? If the connection fails or the permissions are insufficient, AnQiCMS will naturally not work properly.
Incorrect reverse proxy configurationIt is also a frequently asked question.In a production environment, we usually use Nginx or Apache web servers as reverse proxies to forward the traffic from the external access ports 80/443 to the AnQiCMS listening port 8001.If the reverse proxy configuration is incorrect, even if AnQiCMS itself is running normally, external access is not possible.
- Nginx configuration: Check your Nginx configuration file (usually in
/etc/nginx/conf.d/or/etc/nginx/sites-available/directory), especiallyproxy_pass http://127.0.0.1:8001;This line ensures that the target IP and port match the actual listening address of AnQiCMS. Also,try_files $uri $uri/index.html @AnqiCMS;androot /www/wwwroot/anqicms.com/public;These settings are also very important, as they determine how static files are handled and how AnQiCMS requests are proxied.proxy_set_headerRelated settings (such asHost/X-Real-IPAlso needs to be properly configured to ensure that AnQiCMS can correctly obtain client information. - Apache configurationIf you use Apache, you also need to check its configuration (for example
httpd.confor virtual host configuration). It is usually usedProxyPassandProxyPassReversecommands, for exampleProxyPass / http://127.0.0.1:8001/Make sure the path and port are correct. After making changes to the configuration, please restart the Nginx or Apache service to make the changes take effect.
File permission issueSometimes it may also cause the program to fail to start or work normally. Ensure that the AnQiCMS binary fileanqicms) has execute permissionschmod +x anqicms). In addition, the user running it (for examplewww-dataornginxOr the user in the Docker container) needs to set the directory (such aspublic/template/uploadsThe directory of the log file) has read and write permissions. Inadequate permissions may cause the program to fail to write logs, load templates, or save files.
If you are usingDeploy AnQiCMS using DockerThen, the troubleshooting steps will be slightly different, but the core approach remains consistent. First, usedocker ps -aCheck the status of the AnQiCMS container. If the container is in the Exited state, check its Exit Code, which is usually a preliminary indication of the failure cause. Usedocker logs <container_id或name>Command to view container logs, this is the most important error troubleshooting method in the Docker environment. Check the Docker Compose file ordocker runport mapping in the command-p 8001:8001Make sure the host port corresponds to the internal port of the container.At the same time, if the configuration or data of AnQiCMS is mounted to the host machine via a volume (Volume), please check whether the permissions and content of the corresponding path on the host machine are correct.
Third step: check the log for clues
The log is our guide when troubleshooting any complex issues
AnQiCMS' own logIt is usually primary source material. According toinstall.mdDocument description, AnQiCMS will output the running log torunning.logfile (if throughstart.shScript starts).Please check this file, search for keywords such as 'error', 'failed', 'panic', etc., as this information often directly reveals the root cause of program crashes or halts, such as database connection errors, configuration parsing failures, or missing file paths, etc.
Web server access log and error logIt can also provide valuable clues. Nginx logs are usually located in/var/log/nginx/directory, while Apache logs are located in/var/log/apache2/or/var/log/httpd/. By checking the access logs, you can confirm that the request has reached the web server; by the error logs, you can find issues at the reverse proxy level, for example