[root@localhost httpd-2.4.20]# 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 三 2016-06-15 18:37:33 CST; 53s ago
Process: 4258 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 4258 (code=exited, status=1/FAILURE)
6月 15 18:37:32 localhost.localdomain systemd[1]: Starting The Apache HTTP S...
6月 15 18:37:33 localhost.localdomain httpd[4258]: httpd: Syntax error on li...
6月 15 18:37:33 localhost.localdomain systemd[1]: httpd.service: Main proces...
6月 15 18:37:33 localhost.localdomain systemd[1]: Failed to start The Apache...
6月 15 18:37:33 localhost.localdomain systemd[1]: httpd.service: Unit entere...
6月 15 18:37:33 localhost.localdomain systemd[1]: httpd.service: Failed with...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost httpd-2.4.20]# /usr/sbin/httpd $OPTIONS -DFOREGROUND
httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 137 of /etc/httpd/conf.d/system-config-httpd.conf: /etc/httpd/conf.d/system-config-httpd.conf:143: <Directory> was not closed.\n/etc/httpd/conf.d/system-config-httpd.conf:141: <Directory> was not closed.\n/etc/httpd/conf.d/system-config-httpd.conf:139: <Directory> was not closed.\n/etc/httpd/conf.d/system-config-httpd.conf:137: <Directory> was not closed.
Syntax error on line 137 of /etc/httpd/conf.d/system-config-httpd.conf。修改下配置文件的137行。
其他:
service httpd restart 出现 httpd:unrecognized service 错误
vi /etc/rc.local #在/etc/rc.d/rc.local中增加启动apache的命令
添加:
/usr/local/apache2/bin/apachectl start
或者
#将apache注册为系统服务
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
#chmod 700 /etc/rc.d/init.d/httpd
#vi /etc/rc.d/init.d/httpd
在第三行后增加
#Comments to support chkconfig on RedHat Linux
#chkconfig: 2345 90 90
#description:http server
检查下配置文件的137行。