排查 CentOS LAMP 服務器故障時,可以按照以下步驟進行:
ping
命令檢查服務器是否能夠訪問外部網絡。ping -c 4 google.com
traceroute
命令查看數據包在網絡中的路徑。traceroute google.com
/var/log/messages
或 /var/log/syslog
文件,了解系統運行情況。tail -f /var/log/messages
systemctl
命令檢查 LAMP 各組件的狀態。systemctl status httpd
systemctl status mysql
systemctl status php-fpm
apachectl configtest
tail -f /var/log/httpd/access_log
tail -f /var/log/httpd/error_log
nginx -t
tail -f /var/log/nginx/access.log
tail -f /var/log/nginx/error.log
mysql -u root -p
SHOW STATUS;
SHOW VARIABLES;
tail -f /var/log/mysql/error.log
systemctl status php-fpm
tail -f /var/log/php-fpm/error.log
ls -l /var/www/html
setenforce 0
或者修改 /etc/selinux/config
文件,將 SELINUX=enforcing
改為 SELINUX=disabled
。netstat -tuln
ss -tuln
top
htop
systemctl restart httpd
systemctl restart mysql
systemctl restart php-fpm
yum update
通過以上步驟,可以逐步排查 CentOS LAMP 服務器的故障。如果問題依然存在,可以考慮查看更詳細的日志文件或尋求專業的技術支持。