更新后无法启动 HTTPD

更新后无法启动 HTTPD

httpd更新我的实例(CentOS 7)后,我无法启动以前的工作(2.4.6)。

我首先通过 检查了状态systemctl status 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 Wed 2018-12-05 09:05:37 CET; 6s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 8033 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 8032 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 8032 (code=exited, status=1/FAILURE)

Dec 05 09:05:37 vps systemd[1]: Starting The Apache HTTP Server...
Dec 05 09:05:37 vps systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Dec 05 09:05:37 vps kill[8033]: kill: cannot find process ""
Dec 05 09:05:37 vps systemd[1]: httpd.service: control process exited, code=exited status=1
Dec 05 09:05:37 vps systemd[1]: Failed to start The Apache HTTP Server.
Dec 05 09:05:37 vps systemd[1]: Unit httpd.service entered failed state.
Dec 05 09:05:37 vps systemd[1]: httpd.service failed.

没什么帮助,没有具体的错误消息来指引我。因此我做了一个,apachectl configtest它显示了一个问题,即 Let's Encrypt 证书文件不在它应该在的位置或为空。也提到了同样的问题这里

这很奇怪,因为正如我上面指出的问题一样,该证书存在并且openssl可以发挥作用。

根据上述问题的建议,我递归地将/etc/letsencrypt/archive和的权限更改/etc/letsencrypt/live为0755。

现在apachectl configtest不会抱怨任何事情并且输出语法正常。

但是,我的httpd仍然没有以systemctl与上面完全相同的消息开始。

我在这里遗漏了什么?

ps 我还检查了httpd系统中是否有其他进程,并将它们杀死;没有,而且 80 端口上也没有其他进程。

更新

我的 Apache 错误日志:

[Sun Nov 25 03:37:10.247181 2018] [auth_digest:notice] [pid 866] AH01757: generating secret for digest authentication ...
[Sun Nov 25 03:37:10.249196 2018] [lbmethod_heartbeat:notice] [pid 866] AH02282: No slotmem from mod_heartmonitor
[Sun Nov 25 03:37:10.252624 2018] [ssl:warn] [pid 866] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun Nov 25 03:37:10.257286 2018] [ssl:warn] [pid 866] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Sun Nov 25 03:37:10.288880 2018] [mpm_prefork:notice] [pid 866] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.12 configured -- resuming normal operations
[Sun Nov 25 03:37:10.288906 2018] [core:notice] [pid 866] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sun Dec 02 03:46:09.992864 2018] [mpm_prefork:notice] [pid 866] AH00171: Graceful restart requested, doing restart

答案1

我终于弄明白了。

看来我用于可用站点的错误/请求日志存在问题。

systemctl status httpd它没有通过 Apache 自己的状态消息正确地引导我到那里(实际上,Apache 通过或有点神秘journalctl -xe),但通过上面的评论,我能够在那里追踪到它,一旦我:

  • 删除了我过去的所有日志文件(它们真的很乱),
  • 在配置文件中正确命名它们(选择一个通用的命名模式并坚持使用它),
  • 使用上面给出的名称创建了这些,

Apache 能够重新启动。

我猜测发生了突破,因为当我更新系统时,Apache 必须重新启动,并且它读取了已损坏的新配置文件。

相关内容