你应该读这些信息,考虑它告诉你什么并采取适当的行动。

你应该读这些信息,考虑它告诉你什么并采取适当的行动。

我知道存在类似的问题:httpd.service 作业失败

但它与我的不一样。我尝试使用以下方法重新启动 Apache

sudo apachectl restart

我收到以下错误:

httpd.service 作业失败。请参阅“systemctl status httpd.service”和“journalctl -xn”了解详情。

以下是来自的日志systemctl status httpd.service

systemctl status httpd.service 输出

[munna@localhost ~]$ systemctl status -l httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2016-09-27 19:08:26 BDT; 12min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 6262 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 6258 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 6258 (code=exited, status=1/FAILURE)
[munna@localhost ~]$ su
Password:
[root@localhost munna]# systemctl restart httpd
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 munna]# systemctl status -l  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 Tue 2016-09-27 19:21:41 BDT; 10s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 7056 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 7052 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 7052 (code=exited, status=1/FAILURE)

Sep 27 19:21:41 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Sep 27 19:21:41 localhost.localdomain httpd[7052]: AH00526: Syntax error on line 18 of /etc/httpd/conf.d/phpMyAdmin.conf:
Sep 27 19:21:41 localhost.localdomain httpd[7052]: allow not allowed here
Sep 27 19:21:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Sep 27 19:21:41 localhost.localdomain kill[7056]: kill: cannot find process ""
Sep 27 19:21:41 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
Sep 27 19:21:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Sep 27 19:21:41 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Sep 27 19:21:41 localhost.localdomain systemd[1]: httpd.service failed.
[root@localhost munna]#

以下是输出journalctl -xn

在此处输入图片描述

 [root@localhost munna]# journalctl -xn
-- Logs begin at Tue 2016-09-27 18:43:34 BDT, end at Tue 2016-09-27 19:00:01 BDT
Sep 27 19:00:01 localhost.localdomain systemd[1]: Created slice user-0.slice.
-- Subject: Unit user-0.slice has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-0.slice has finished starting up.
-- 
-- The start-up result is done.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Starting user-0.slice.
-- Subject: Unit user-0.slice has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-0.slice has begun starting up.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Started Session 4 of user root
-- Subject: Unit session-4.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-4.scope has finished starting up.
-- 
-- The start-up result is done.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Starting Session 4 of user roo
-- Subject: Unit session-4.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-4.scope has begun starting up.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Started Session 5 of user root
-- Subject: Unit session-5.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-5.scope has finished starting up.
-- 
-- The start-up result is done.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Starting Session 5 of user roo
-- Subject: Unit session-5.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-5.scope has begun starting up.
Sep 27 19:00:01 localhost.localdomain CROND[5612]: (root) CMD (/usr/lib64/sa/sa1
Sep 27 19:00:01 localhost.localdomain CROND[5613]: (root) CMD (/etc/webmin/bandw
Sep 27 19:00:01 localhost.localdomain systemd[1]: Removed slice user-0.slice.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-0.slice has finished shutting down.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Stopping user-0.slice.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-0.slice has begun shutting down.
lines 35-57/57 (END)
-- Unit session-5.scope has finished starting up.
-- 
-- The start-up result is done.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Starting Session 5 of user root.
-- Subject: Unit session-5.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-5.scope has begun starting up.
Sep 27 19:00:01 localhost.localdomain CROND[5612]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Sep 27 19:00:01 localhost.localdomain CROND[5613]: (root) CMD (/etc/webmin/bandwidth/rotate.pl)
Sep 27 19:00:01 localhost.localdomain systemd[1]: Removed slice user-0.slice.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-0.slice has finished shutting down.
Sep 27 19:00:01 localhost.localdomain systemd[1]: Stopping user-0.slice.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit user-0.slice has begun shutting down.
~
~
~
~
~
~
~
~
~
~
~
lines 35-57/57 (END)

答案1

您提供的信息systemctl status httpd.service看上去很有趣也很有用,但是我们无法读懂,因为它已被省略了。

9 月 27 日 18:57:57 localhost.localdomain httpd[5357]: AH00526: l 上的语法错误... 9 月 27 日 18:57:57 localhost.localdomain httpd[5357]: 此处不允许

幸运的是,输出还告诉你该怎么做

提示:有些线条被省略了,使用 -l 可以完整显示。

所以这里要做的事情是运行

systemctl status -l httpd

这将用缺失的信息填补空白。

应该这些信息,考虑它告诉你什么并采取适当的行动。

答案2

谢谢大家的帮助。我刚刚解决了这个问题。当我尝试编辑配置文件时,出现了问题/etc/httpd/conf.d/phpMyAdmin.conf

我在第 18 行添加了一行,因此我必须删除该行才能使 httpd 再次工作。:)

干杯!!

相关内容