以下是CentOS上Apache故障的排查步骤:
systemctl status httpd
,未运行则启动systemctl start httpd
。tail -f /var/log/httpd/error_log
,定位具体错误信息。apachectl configtest
,修复语法错误。netstat -tuln | grep 80
,修改httpd.conf
中Listen
端口或停止占用进程。chown -R apache:apache /path/to/directory
,chmod -R 755 /path/to/directory
。firewall-cmd --add-service=http --permanent
,firewall-cmd --reload
。setenforce 0
,或调整策略允许Apache访问。top
或htop
,确保内存、CPU充足。/etc/httpd/conf.d/
目录下文件,确认ServerName
和DocumentRoot
正确。httpd -M
查看,必要时重新编译安装。若以上步骤无效,可参考Apache官方文档或社区论坛进一步排查[1,2,3,4,5,6,7,8,9,10]。