Apache 不会启动并且没有错误

Apache 不会启动并且没有错误

阿帕奇不会启动。日志中没有任何错误。我在哪里可以找到更多信息?

$ 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

相关内容