一、错误提示:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details. 二、排查步骤:
1、使用journalctl -xe查看日志提示。
2、使用systemctl status httpd 查看Apache状态信息。
3、使用netstat -antlp |grep 80 查看80端口是否被占用。
[root@localhost ~]# netstat -antlp |grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 23917/nginx: master
tcp 0 0 192.168.1.130:52908 117.18.237.29:80 ESTABLISHED 23957/firefox
tcp 0 0 192.168.1.130:35046 8.43.84.214:80 FIN_WAIT2 -
tcp6 0 0 :::80 :::* LISTEN 23917/nginx: master
以上信息可以看到80端口被Nginx服务占用。
三、解决方法:
1、此时有两种解决方式,如果不是用Nginx的情况下把占用80端口的Nginx服务kili掉即可。
2、第二种是把Apache的端口该成别的端口。
[root@localhost ~]# vi /etc/httpd/conf/httpd.conf
Change this to Listen on specific IP addresses as shown below to
prevent Apache from glomming onto all bound IP addresses.
#Listen 12.34.56.78:80
Listen 80 //该成8080 即可
1⃣️然后重启httpd服务即可。
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable
2⃣️防火墙也放行即可
firewall-cmd --zone=public --add-port=8080/tcp --permanent