As a senior CMS website operation person in the security industry, I know the anxiety of not being able to access the website and not seeing the process PID.In this case, the system log is the key 'eye' for us to understand the root cause of the problem.The AnQi CMS is developed based on Go language, its efficient and stable characteristics make it rarely have problems during normal operation, but once it does, it often means there is an issue with the startup environment or external dependencies.
AutoCMS process startup mechanism overview
AnQiCMS usually through a startup script (such asstart.sh)to manage its processes.The core function of this script is to check if the AnQiCMS main program is running, if not, it will try to start it and redirect its output to a log file.In environments such as Baota panel, this script is usually configured as a cron job to run every minute to ensure the robustness of the website process.ps -ef | grep anqicmsWhen the command cannot find the process ID of AnQiCMS, the first thing we should suspect is that the AnQiCMS program may not have started successfully, or it exited abnormally soon after startup.
Core Troubleshooting Thoughts
Identify such issues, we need to check systematically from the outside to the inside.Firstly, confirm whether the AnQiCMS program itself can execute normally, then check its runtime dependencies, and finally review the network configuration.The log files are the most valuable clues in this process, recording various events during program execution, including error information.
Detailed Steps for System Log Troubleshooting
When the PID of AnQiCMS disappears and the website cannot be accessed, the following steps should be taken to view the relevant logs:
Confirm AnQiCMS process status
Although we have found that the PID is missing, it is necessary to confirm again. Log in to the server and execute the following command:
ps -ef | grep anqicms
If there is no output or the output does not contain the main process information of AnQiCMS, then it can be肯定 that the AnQiCMS process is indeed not running.If you see the process but the website still cannot be accessed, it may be a problem with port listening or reverse proxy, but we are currently focusing on the case where the process does not exist.
Check the startup script log
The startup script of AnQiCMS, such asstart.shIt usually records its execution status. In the installation document, we seestart.shWill write logs tocheck.logandrunning.log.
check.log: This file usually records thestart.shScript execution results of AnQiCMS process status each time it is executed by cron. Check this file to understandstart.shWhether it is working normally, and whether it has ever tried to start AnQiCMS.tail -f /www/wwwroot/anqicms/check.log(Assuming AnQiCMS path)running.log: This is the standard output and standard error log of the AnQiCMS application.If AnQiCMS tries to start but fails, or crashes due to a fatal error after startup, the error information is often here.This is the golden location to troubleshoot internal application errors.tail -f /www/wwwroot/anqicms/running.log
Read carefullyrunning.log. Common reasons for startup failure include:
* **端口冲突**: AnQiCMS尝试监听的端口(例如8001)可能已被其他程序占用。
* **数据库连接失败**: 数据库服务未启动,或AnQiCMS的配置(`config.json`)中数据库连接信息不正确。
* **文件权限不足**: AnQiCMS程序或其依赖的文件(如模板文件、数据目录)没有正确的读写执行权限。
* **配置错误**: `config.json`中的关键配置项有语法错误或值不合法。
* **内存或CPU不足**: 系统资源耗尽导致程序无法正常启动或运行。
analyze AnQiCMS application internal log
Exceptrunning.logAnQiCMS in more detailed error scenarios may also write error logs to specific files (if configured).Although the document does not explicitly mention, in actual operation, Go applications may have more granular log configuration.running.logthe information is insufficient to locate the problem, you can look for other files ending with in the AnQiCMS installation directory,.logor by viewingconfig.jsonFile, look for places where the log path and level are configured.
Check system-level logs
If the application-level logs above do not explicitly indicate the problem, or show that the program exited due to external environmental issues, you need to check the system-level logs.
For using
systemdManaged services (for example, if you configure AnQiCMS as a system service):systemctl status anqicms(Replace)anqicmswith your service name)journalctl -u anqicms -xe(View detailed service logs) These commands will display detailed information about service startup, shutdown, crashes, and other events, as well as system errors that may cause crashes.For general Linux system issues:
dmesg: Display kernel ring buffer information, may include low-level errors related to hardware, memory, disk I/O, etc.var/log/syslogor/var/log/messages:System general log, records system events, service status, etc., and sometimes can discover anomalies of other programs or system resource alarms.
Check reverse proxy log
AnQiCMS is usually deployed after Nginx or Apache and other reverse proxies.If the AnQiCMS process is not running, the reverse proxy cannot connect to it naturally.Check the error log of the reverse proxy to confirm this.
- Nginx: Error log is usually located
/var/log/nginx/error.log. If AnQiCMS is not running, you might see something likeconnect() failed (111: Connection refused) while connecting to upstreamThe error indicates that Nginx cannot connect to the port that AnQiCMS is listening on. - Apache: Error log is usually located
/var/log/apache2/error.logor/var/log/httpd/error.logSimilarly, it will display an error indicating that the connection to the backend Go application has failed.
The access.log of the reverse proxy can also help us understand if there are external requests reaching the server, as well as the HTTP status codes received by these requests (such as, 502 Bad Gateway).
Verify port occupation situation
Port conflict is a common cause of startup failure in Go applications. AnQiCMS defaults to listening on port 8001. Use the following command to check if the port is in use:
lsof -i:8001
If the command has output, it means that port 8001 is being used by some process. You cankill -9 {PID}Command to terminate the process occupying the port. Then try to manually start AnQiCMS and observerunning.log.
Check file permissions
Ifstart.shThe script cannot be executed, or the main program of AnQiCMS (anqicmsExecutable file) does not have execution permission, the program cannot start naturally.
- Check the file permissions of the AnQiCMS installation directory:
ls -l /www/wwwroot/anqicms/(Assuming AnQiCMS path) - Ensure
anqicmsExecutable file has execution permission (x) andwwwUser (or the user you configured to run) has read and write permissions to the AnQiCMS installation directory and its subdirectories. If the permissions are incorrect, you can usechmod +x anqicmsto grant execution permissions and usechown -R www:www /www/wwwroot/anqicmsChange owner.
Summary and Suggestions
Through the above systematic log troubleshooting, we are usually able to locate the specific cause of the AnQiCMS process PID not existing but the website being inaccessible.The key lies in patiently and meticulously analyzing each log file and stringing them together as clues.Developing a habit of regularly checking logs can help us discover and solve issues before they grow.
After the issue is resolved, please manually execute the AnQiCMS startup script and continue to observe.running.logA few minutes, ensure that the program runs stably and no new error logs appear.If AnQiCMS is managed by a scheduled task or system service, it is also necessary to ensure that these management mechanisms are configured correctly and can automatically restart AnQiCMS after a process crash.
Common Questions and Answers (FAQ)
Q1: I have checked.running.logWhat does the error 'address already in use' mean?
A1: This error usually means that the port (such as the default 8001) that AnQiCMS is trying to listen to has been occupied by another program on the server. You need to uselsof -i:{端口号}commands (for examplelsof -i:8001)to find the process occupying the port, then terminate the process or modify AnQiCMS'sconfig.jsonFile, change the port number to another unused port, and restart AnQiCMS.
Q2: I foundstart.shThe script seems not to have been executed,check.logThere are no new records, what's going on?
A2: Ifstart.shThe script was not executed, which may be due to an issue with the configuration of the cron job it is set to run. You need to check if the cron configuration on the server is correct, for example, in a Linux system,crontab -lView the current user's scheduled task list.Ensure that the task path, execution user, and execution frequency are set correctly, and that the cron service itself is also running normally.start.shscript.
Q3:running.logAn error occurred while displaying the database connection, but I am sure that the database service is running and the password is correct. Are there any other possibilities?
A3: In addition to the database service not being started or the password being incorrect, a database connection failure may also be caused by the following reasons:
1. **数据库配置的IP地址或端口不正确**:确保AnQiCMS的`config.json`中数据库的`Host`和`Port`指向正确的数据库服务器地址。
2. **数据库用户没有从AnQiCMS服务器IP连接的权限**:某些数据库(如MySQL)会限制用户只能从特定的IP地址连接。你需要检查数据库的用户权限设置,确保AnQiCMS运行的服务器IP地址在允许连接的范围内。
3. **防火墙阻止了AnQiCMS与数据库之间的通信**:服务器的防火墙可能阻止了AnQiCMS的出站连接或数据库服务器的入站连接。检查并配置防火墙规则以允许AnQiCMS访问数据库端口(例如MySQL的3306端口)。