[root@localhost ~]# 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.
[root@localhost ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-02-01 14:41:03 EST; 8s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 3099 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 3098 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 3098 (code=exited, status=1/FAILURE)
Feb 01 14:41:03 localhost.localdomain systemd[1]: Starting The Apache HTTP Se...
Feb 01 14:41:03 localhost.localdomain httpd[3098]: AH00526: Syntax error on l...
Feb 01 14:41:03 localhost.localdomain httpd[3098]: Invalid command 'Comment',...
Feb 01 14:41:03 localhost.localdomain systemd[1]: httpd.service: main process...
Feb 01 14:41:03 localhost.localdomain kill[3099]: kill: cannot find process ""
Feb 01 14:41:03 localhost.localdomain systemd[1]: httpd.service: control proc...
Feb 01 14:41:03 localhost.localdomain systemd[1]: Failed to start The Apache ...
Feb 01 14:41:03 localhost.localdomain systemd[1]: Unit httpd.service entered ...
Feb 01 14:41:03 localhost.localdomain systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
答案1
该问题似乎是 apache 配置文件中的语法错误。查看您的错误日志(通常/var/log/httpd/error_log
或/var/log/apache2/error_log
了解更多信息)。纠正错误,您的 apache 服务器可能会启动。
答案2
您可以使用以下方法验证您的配置文件语法:
apachectl configtest
从https://httpd.apache.org/docs/2.4/programs/apachectl.html:
configtest
Run a configuration file syntax test. It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error. This is equivalent to apachectl -t.
答案3
[2017 年 2 月 1 日星期三 06:58:40.131743 2017] [核心:通知] [pid 11281] SELinux 策略 enab$ [2017 年 2 月 1 日星期三 06:58:40.133098] [suexec:notice] [pid 11281] AH01232: suEXEC m$ AH00558 : httpd: 无法可靠地确定服务器的完全限定的 domai$ [Wed Feb 01 06:58:40.165629 2017] [auth_digest:notice] [pid 11281] AH01757: gen$ [Wed Feb 01 06:58:40.167758 2017] [lbmethod_heartbeat :通知] [pid 11281] AH022$ [2017 年 2 月 1 日星期三 06:58:40.318077 2017] [mpm_prefork:通知] [pid 11281] AH00163: Apa$ [2017 年 2 月 1 日星期三 06:58:40.318136] [核心:通知] [ pid 11281] AH00094:命令 li$ [Wed Feb 01 07:12:30.844891 2017] [mpm_prefork:notice] [pid 11281] AH00170:cau$