![Apache 不会启动并且没有错误](https://linux22.com/image/93784/Apache%20%E4%B8%8D%E4%BC%9A%E5%90%AF%E5%8A%A8%E5%B9%B6%E4%B8%94%E6%B2%A1%E6%9C%89%E9%94%99%E8%AF%AF.png)
阿帕奇不会启动。日志中没有任何错误。我在哪里可以找到更多信息?
$ systemctl status httpd.service -l
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2016-09-04 09:26:03 EDT; 2min 35s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 2303 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 2302 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 2302 (code=exited, status=1/FAILURE)
$ journalctl --dmesg
No journal files were found.
答案1
journalctl --dmesg
显示内核错误消息,而不是应用程序错误消息。
journalctl -xe
可能会显示更多错误消息。例如,我向我添加了一条坏线httpd.conf
,现在我可以看到
-- Unit httpd.service has begun starting up.
Sep 04 09:39:04 server httpd[24802]: AH00526: Syntax error on line
Sep 04 09:39:04 server httpd[24802]: Invalid command 'gibber', perh
Sep 04 09:39:04 server systemd[1]: httpd.service: main process exit
Sep 04 09:39:04 server kill[24804]: kill: cannot find process ""
Sep 04 09:39:04 server systemd[1]: httpd.service: control process e
Sep 04 09:39:04 server systemd[1]: Failed to start The Apache HTTP
-- Subject: Unit httpd.service has failed
由于这是apache
您还可以运行httpd -t
它将尝试解析配置文件并报告任何错误。
% httpd -t
AH00526: Syntax error on line 2 of /etc/httpd/conf/httpd.conf:
Invalid command 'gibber', perhaps misspelled or defined by a module not included in the server configuration