首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么httpd在简单的更改后不能重新启动?

为什么httpd在简单的更改后不能重新启动?
EN

Stack Overflow用户
提问于 2019-01-05 05:28:04
回答 2查看 805关注 0票数 0

Oracle Linux 7.2

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

这是我所看到的:

代码语言:javascript
复制
[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.

帮助?

EN

回答 2

Stack Overflow用户

发布于 2019-01-05 05:57:25

必须有一个进程(比如仍在处理中的web请求)附加到httpd,导致它无法重新启动。我在您的错误消息中看到,ID为3299的进程正在尝试终止,但失败了。使用以下命令检查此进程是否正在运行

代码语言:javascript
复制
ps -ef | grep 3299 

或者使用

代码语言:javascript
复制
ps -ef| grep apache

请参阅手册ps

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

如果您发现进程仍在运行,则可以使用以下命令手动终止它

代码语言:javascript
复制
kill -9 3299

使用-9标志将防止任何进程阻塞终止。

man kill

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

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

这个解决方案有点非正统,但作为最后的手段,有时你需要手动终止一个被阻塞的画眉进程。

票数 0
EN

Stack Overflow用户

发布于 2019-01-07 03:53:58

好吧,我想通了。我们的SSL证书已经过期了,所以我续订了它。当我替换httpd.conf文件的各个VirtualHost部分中的证书时,我还忘记了替换SSL证书的密钥。这就导致了这个问题。当我返回并更新相应SSL证书的密钥时,Apache立即启动。

我认为这是一个错误,当这种情况发生时,在错误消息中没有根本原因的痕迹。幸运的是,我很快就明白了这一点。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54046317

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档