报错现象

[root@prometheus ~]# systemctl start httpd
s^HJob 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查看日志提示;
使用systemctl status httpd 查看Apache状态信息;

2.查看端口占用情况

[root@prometheus ~]# netstat -antlp |grep 80
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      8996/puma 5.6.2 (un 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      9000/nginx: master  
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      14437/sidekiq_expor 
tcp        0      0 127.0.0.1:8092          0.0.0.0:*               LISTEN      14435/sidekiq 6.4.0 
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      9000/nginx: master  
可以看到80端口是被nginx占用了,所以我们要给apache另外改个端口.

3.修改apache端口

[root@prometheus ~]# vi /etc/httpd/conf/httpd.conf
42行处把Listen 80 //该成9999 即可

4.重启服务

[root@prometheus ~]# firewall-cmd --zone=public --add-port=9999/tcp --permanent
[root@prometheus ~]# systemctl start httpd
[root@prometheus ~]# systemctl enable httpd
最后修改:2022 年 08 月 31 日
如果觉得我的文章对你有用,请随意赞赏