简单更改后,为什么httpd无法重启?

时间:2019-01-04 21:28:04

标签: apache ssl-certificate

Oracle Linux 7.2

我在httpd.conf文件中为特定域更新了SSL证书。 然后,我做了一个“ sudo服务httpd重新启动”,它挂了很长时间(超过一分钟),然后出错了。现在,我无法重新启动httpd,并且在'systemctl status httpd.service'或'journalctl -xe'中也看不到任何提示。

这就是我所看到的:

[oracle@secure-web-server-dvl ~]$ sudo service httpd start
Redirecting to /bin/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.
[oracle@secure-web-server-dvl ~]$ 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 Fri 2019-01-04 16:22:31 EST; 37s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 3299 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 3297 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 3297 (code=exited, status=1/FAILURE)

Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: Starting The Apache HTTP Server...
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com kill[3299]: kill: cannot find process ""
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: httpd.service: control process exited, code=exited status=1
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: Failed to start The Apache HTTP Server.
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: Unit httpd.service entered failed state.
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: httpd.service failed.
[oracle@secure-web-server-dvl ~]$ journalctl -xe
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
--
-- A new session with the ID 1 has been created for the user oracle.
--
-- The leading process of the session is 3259.
Jan 04 16:22:15 secure-web-server-dvl.nitssolutions.com systemd[1]: Started Session 1 of user oracle.
-- Subject: Unit session-1.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-1.scope has finished starting up.
--
-- The start-up result is done.
Jan 04 16:22:15 secure-web-server-dvl.nitssolutions.com systemd[1]: Starting Session 1 of user oracle.
-- Subject: Unit session-1.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-1.scope has begun starting up.
Jan 04 16:22:15 secure-web-server-dvl.nitssolutions.com sshd[3259]: pam_unix(sshd:session): session opened for user oracle by (uid=0)
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com sudo[3281]:   oracle : TTY=pts/0 ; PWD=/home/oracle ; USER=root ; COMMAND=/sbin/service httpd st
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com polkitd[618]: Registered Authentication Agent for unix-process:3282:11555 (system bus name :1.14
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com kill[3299]: kill: cannot find process ""
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: httpd.service: control process exited, code=exited status=1
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: Unit httpd.service entered failed state.
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com systemd[1]: httpd.service failed.
Jan 04 16:22:31 secure-web-server-dvl.nitssolutions.com polkitd[618]: Unregistered Authentication Agent for unix-process:3282:11555 (system bus name :1.

帮助?

2 个答案:

答案 0 :(得分:0)

必须在httpd上附加一个进程(例如仍在处理的Web请求),这导致它无法重新启动。 我在您的错误消息中看到ID 3299的进程正试图被杀死,但是失败了。 使用以下方法检查该进程是否正在运行

ps -ef | grep 3299 

或使用

ps -ef| grep apache

请参见人ps

这将向您显示查看当前进程快照的手册

如果发现该进程仍在运行,则可以使用命令

手动将其杀死。
kill -9 3299

使用-9标志将阻止任何进程阻止kill。

请参见杀人

这应该允许您再次启动httpd服务。

警告:手动终止进程可能会损坏配置文件。 首先为您的apache / httpd服务器备份配置文件!

此解决方案有点不合常规,但作为最后的手段,有时您需要手动杀死正在被阻止的胭脂过程。

答案 1 :(得分:0)

好,我知道了。我们的SSL证书已过期,因此我续订了该证书。当我替换httpd.conf文件的各个VirtualHost部分中的证书时,我忘记也替换了SSL证书的密钥。造成了问题。当我返回并更新相应SSL证书的密钥时,Apache马上启动了。

我认为这是一个错误,当这种情况发生时,错误消息中没有根本原因的痕迹。我很幸运能够很快找到答案。