启动Apache服务失败

启动Apache服务失败

当我尝试运行 apache 时,它​​向我显示以下错误:

[manideep@localhost ~]$ sudo  httpd -t
Syntax OK

[manideep@localhost ~]$ sudo service httpd start

Redirecting to /bin/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.

[manideep@localhost ~]$ sudo service httpd status
Redirecting to /bin/systemctl status  httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2017-03-05 15:52:12 PST; 6s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 4115 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 4110 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 4110 (code=exited, status=1/FAILURE)

Mar 05 15:52:12 localhost.localdomain httpd[4110]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Mar 05 15:52:12 localhost.localdomain httpd[4110]: (98)Address already in use: AH00072: make_sock: could not bind to address ...0.0:80
Mar 05 15:52:12 localhost.localdomain httpd[4110]: no listening sockets available, shutting down
Mar 05 15:52:12 localhost.localdomain httpd[4110]: AH00015: Unable to open logs
Mar 05 15:52:12 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 05 15:52:12 localhost.localdomain kill[4115]: kill: cannot find process ""
Mar 05 15:52:12 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 05 15:52:12 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Mar 05 15:52:12 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Mar 05 15:52:12 localhost.localdomain systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

答案1

你需要找出是什么程序占用了端口80

netstat -ltp | grep :80

然后杀死该进程并重新启动apache服务

答案2

可能是网站文件有问题*.conf。这个命令可以给出一个提示:

apachectl configtest

答案3

我有同样的问题并解决了它。

sudo service apache2 start

作业apache2.service failed原因是控制进程退出并出现错误代码。详情请参阅systemctl status apache2.service和“ ”。journalctl -xe

中存在配置问题000-default.conf。我没有正确关闭 VirtualHost 标签。

相关内容