为什么 Apache 在启动时尝试终止一个进程,以及为什么这会导致 Apache 启动失败?

为什么 Apache 在启动时尝试终止一个进程,以及为什么这会导致 Apache 启动失败?

我正在安装一个新证书,就像我以前做过几十次一样。我复制了名称 crt、key、bundle 文件作为备份,并为新文件赋予了旧文件的名称。然后我重新启动了 apache。失败了。它给出了如下所示的错误。

我尝试重启服务器。再次检查,没有任何变化。我删除了新上传的文件并用备份副本替换,然后尝试再次重启。它仍然显示相同的消息。我以前从未见过此错误。配置文件没有任何更改。

1)了解 Apache 内部工作原理的人知道为什么它会尝试终止一个不存在且找不到的进程吗?

2)既然它不存在,为什么会阻止 Apache 启动?

sudo systemctl 状态 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 Thu 2018-12-06 23:12:20 EST; 9s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 3615 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 3613 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 3613 (code=exited, status=1/FAILURE)

Dec 06 23:12:20 myHostsystemd[1]: Starting The Apache HTTP Server...
Dec 06 23:12:20 myHostsystemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Dec 06 23:12:20 myHostkill[3615]: kill: cannot find process ""
Dec 06 23:12:20 myHostsystemd[1]: httpd.service: control process exited, code=exited status=1
Dec 06 23:12:20 myHostsystemd[1]: Failed to start The Apache HTTP Server.
Dec 06 23:12:20 myHostsystemd[1]: Unit httpd.service entered failed state.
Dec 06 23:12:20 myHostsystemd[1]: httpd.service failed.

sudo journalctl -xe 只是说了同样的事情。

服务器运行的是centOS 7。Apache版本是2.4.6。

答案1

你的服务单位已经kill采取ExecStop行动,所以这不是试图杀死自己孩子的阿帕奇人,而是systemd尝试终止已经停止的进程。

而 apache 无法启动的主要原因就是这个进程退出了。我敢打赌,原因肯定在 apache 的 main 中error_log

  • RHEL / Red Hat / CentOS / Fedora Linux Apache 错误文件位置:/var/log/httpd/error_log
  • Debian / Ubuntu Linux Apache 错误日志文件位置:/var/log/apache2/error.log
  • FreeBSD Apache 错误日志文件位置:/var/log/httpd-error.log

相关内容