How to assist in troubleshooting the issue of AnQiCMS process PID not existing but the website is inaccessible by checking the system logs?
As a senior CMS website operation personnel of an information security company, I know the anxiety of the website being inaccessible but the process PID not being found.In this case, the system log is the key 'eye' to uncovering the root of the problem.The Anqi CMS is developed based on Go language, its high efficiency and stability make it rarely have problems during normal operation, but once it does, it often means that the startup environment or external dependencies are in trouble.
AnQi CMS process startup mechanism overview
AnQi CMS usually starts through a startup script (such asstart.shTo manage its processes. The core function of this script is to check if the AnQiCMS main program is running, and if not, try to start it and redirect its output to a log file.Under Baota panel and similar environments, this script is usually configured as a scheduled task (cron job), executed once a minute to ensure the robustness of the website process.When the website is inaccessible, and throughps -ef | grep anqicmsWhen the command cannot find the process ID of AnQiCMS, we should first suspect that the AnQiCMS program has not started successfully, or it exited abnormally soon after startup.
Core troubleshooting approach
We need to systematically check from the outside to the inside to solve such problems.Firstly, confirm that the AnQiCMS program itself can run normally, then check its runtime dependencies, and finally examine the network configuration.Log files are the most valuable clues in this process, recording all kinds of events during program execution, including error messages.
Detailed troubleshooting steps for system logs
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 already discovered a missing PID, 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 definitely confirmed 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 currently we are focusing on the case where the process does not exist.
Check the startup script log
AnQiCMS's startup script, such asstart.shwhich usually records its execution status. In the installation documentation, we seestart.shit will write logs tocheck.logandrunning.log.
check.log: This file usually recordsstart.shThe script checks the process status of AnQiCMS each time it is executed by cron. By checking this file, you can understandstart.shWhether it is working normally, and whether it has ever tried to start AnQiCMS.tail -f /www/wwwroot/anqicms/check.log(Assuming the path of AnQiCMS)running.logThis is the standard output and standard error log of the AnQiCMS application.If AnQiCMS attempts to start but fails, or crashes after startup due to a fatal error, the error information is often here.This is the golden position for troubleshooting internal application errors.tail -f /www/wwwroot/anqicms/running.log
Read carefullyrunning.logcontent. Common reasons for startup failure include:
* **端口冲突**: AnQiCMS尝试监听的端口(例如8001)可能已被其他程序占用。
* **数据库连接失败**: 数据库服务未启动,或AnQiCMS的配置(`config.json`)中数据库连接信息不正确。
* **文件权限不足**: AnQiCMS程序或其依赖的文件(如模板文件、数据目录)没有正确的读写执行权限。
* **配置错误**: `config.json`中的关键配置项有语法错误或值不合法。
* **内存或CPU不足**: 系统资源耗尽导致程序无法正常启动或运行。
Analyze AnQiCMS application internal logs
exceptrunning.log,AnQiCMS in more detailed error scenarios may also write error logs to specific files (if configured).Although the document does not explicitly mention, in practice, Go applications may have more granular log configuration. Ifrunning.logThe information is insufficient to locate the problem, you can look for other files ending with in the AnQiCMS installation directory,.logor by checkingconfig.jsonFile, find where the log path and level are configured.
View system-level logs
If the above application-level logs do not explicitly indicate the problem or show that the program has exited due to external environmental issues, you need to check the system-level logs.
For using
systemdManaged service (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 start, stop, crash events, as well as system errors that may cause crashes.For general Linux system issues:
dmesg: Displays kernel ring buffer information, may include low-level errors related to hardware, memory, disk I/O, etc.var/log/syslogor/var/log/messagesSystem general log, records system events, service status, etc., and sometimes can find other program exceptions 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 logs are usually located
/var/log/nginx/error.log. If AnQiCMS is not running, you might see something similar toconnect() failed (111: Connection refused) while connecting to upstreamThe error indicates that Nginx cannot connect to the port being listened to by AnQiCMS. - Apache: Error logs are 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 (access.log) can also help us understand if there are external requests reaching the server, as well as the HTTP status codes received by these requests (for example, 502 Bad Gateway).
Verify port occupancy situation
Port conflict is a common cause of startup failure for Go applications. AnQiCMS listens on port 8001 by default. Use the following command to check if the port is occupied:
lsof -i:8001
If the command has output, it means that port 8001 is being occupied by a 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 permissions, the program cannot start naturally.
- Check the file permissions of the AnQiCMS installation directory:
ls -l /www/wwwroot/anqicms/(Assuming the path of AnQiCMS) - Ensure
anqicmsExecutable file has execution permissions (x) andwwwThe user (or the user you configure to run) has read and write permissions on 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 the owner.
Summary and suggestions
Through the above systematic log troubleshooting, we can usually locate the specific cause of the AnQiCMS process PID not existing but the website being inaccessible.The key is to analyze each log file patiently and meticulously, linking them together as clues.Establishing a habit of regularly checking logs can help us discover and resolve issues before they expand.
After the issue is resolved, be sure to manually execute the AnQiCMS startup script and continue to observe.running.loga few minutes, ensure the program runs stably without any new error logs.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.
Frequently Asked Questions (FAQ)
Q1: I checked.running.logWhat does the error message "address already in use" mean?
A1: This error usually means that AnQiCMS is trying to listen on a port (such as the default 8001) that is already occupied by another program on the server. You need to uselsof -i:{端口号}commands (for examplelsof -i:8001To find the process occupying the port, then terminate the process or modify AnQiCMS'sconfig.jsonFile, change the port number to an unused port and restart AnQiCMS.
Q2: I foundstart.shThe script seems not to have been executed,check.logWhat is this new record?
A2: Ifstart.shThe script was not executed, which may be due to a problem with the configuration of its scheduled task (cron job). You need to check if the server's cron configuration is correct, for example, on a Linux system, you can access it bycrontab -lCheck the current user's scheduled task list. Make sure the task path, execution user, and execution frequency are set correctly, and the cron service itself is also running normally.Sometimes, environmental variable issues may also cause cron tasks to not be foundstart.shscript.
Q3:running.logIs there any other possibility, as the database connection failed to display, but I am sure that the database service is running and the password is correct?
A3: In addition to the database service not being started or a password error, 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端口)。