LAMP服务器故障排查可按以下步骤进行:
systemctl status apache2
、systemctl status mysql
、systemctl status php-fpm
(或对应服务名)确认各组件是否正常运行。/var/log/apache2/error.log
或/var/log/httpd/error_log
。/var/log/mysql/error.log
或/var/log/mysqld.log
。/var/log/php-fpm.log
或php.ini
中配置的错误日志路径。apachectl configtest
检查语法,确保/etc/apache2/apache2.conf
等配置正确。/etc/my.cnf
或/etc/mysql/my.cnf
,确认bind-address
、端口等设置。netstat -tulnp | grep -E '80|3306|9000'
检查端口占用,解决冲突。/var/www/html
)权限为755
,属主为Web服务器用户(如www-data
)。ping
、telnet
或nc
测试服务器网络连通性。mysql -u username -p
命令行测试数据库连接,验证用户名、密码及权限。top
、free -m
、df -h
查看CPU、内存、磁盘空间是否充足。ufw
或iptables
)是否放行必要端口。setenforce 0
,确认是否因安全策略导致问题。phpinfo()
)验证环境基础功能。参考来源: