centos7启动httpd服务失败:Job for httpd.service failed because the control process exited with error code.

本文介绍了在CentOS7系统中,如何使用`servicehttpdstart`或`systemctlstarthttpd.service`命令启动httpd服务,遇到端口被nginx占用时,如何通过`systemctlstopnginx`关闭nginx并解决问题。同时提供了开机关闭nginx的指令。
摘要由CSDN通过智能技术生成

centos7启动httpd命令有两个可以用
service httpd start    systemctl start httpd.service
如果出现如下报错
Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.
应该是端口被占用,查看端口
netstat -antlp | grep 80
在这里插入图片描述
是nginx占用了端口
systemctl stop nginx.service 停用nginx即可
如果想开机关闭nginx则输入命令 systemctl disable nginx

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
这个错误提示表明httpd服务控制进程退出时发生了错误,可以通过以下步骤查看详细信息: 1. 运行命令`systemctl status httpd.service`,查看httpd服务的状态信息和错误提示,例如: ``` $ systemctl status httpd.servicehttpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2021-08-18 09:30:43 CST; 1min 30s ago Docs: man:httpd.service(8) Process: 1234 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Aug 18 09:30:43 example.com systemd[1]: Starting The Apache HTTP Server... Aug 18 09:30:43 example.com httpd[1234]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.1. Set the 'ServerName' directive globally to suppress this message Aug 18 09:30:43 example.com systemd[1]: httpd.service: control process exited, code=exited status=1 Aug 18 09:30:43 example.com systemd[1]: Failed to start The Apache HTTP Server. Aug 18 09:30:43 example.com systemd[1]: Unit httpd.service entered failed state. Aug 18 09:30:43 example.com systemd[1]: httpd.service failed. ``` 2. 运行命令`journalctl -xe`,查看系统日志中与httpd服务相关的错误信息,例如: ``` $ journalctl -xe ... Aug 18 09:30:43 example.com httpd[1234]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 Aug 18 09:30:43 example.com httpd[1234]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 Aug 18 09:30:43 example.com httpd[1234]: no listening sockets available, shutting down Aug 18 09:30:43 example.com httpd[1234]: AH00015: Unable to open logs Aug 18 09:30:43 example.com systemd[1]: httpd.service: control process exited, code=exited status=1 Aug 18 09:30:43 example.com systemd[1]: Failed to start The Apache HTTP Server. ``` 根据上面的错误提示,可以看到httpd服务无法绑定到端口80,可能是因为该端口已被其他服务占用。解决方法是找到并停止占用端口80的服务,或者修改httpd配置文件中监听的端口号。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值