如何确定 Apache 无法重新启动的原因?

如何确定 Apache 无法重新启动的原因?

我刚刚在 RHEL 8 服务器上安装了新证书。我更新了conf 文件并重新启动了Apache。 Apache 失败了,但我不明白为什么。我如何确定导致问题的原因?以下是 Apache 返回的内容:

$ sudo journalctl -xe
Jul 25 07:39:54 ylntest.yln.info sudo[215986]: pam_unix(sudo:session): session opened for user root by administrator(uid=0)
Jul 25 07:39:54 ylntest.yln.info systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit httpd.service has begun starting up.
Jul 25 07:39:54 ylntest.yln.info httpd[215989]: [Tue Jul 25 07:39:54.455473 2023] [so:warn] [pid 215989] AH01574: module php_module is already loaded, skipping
Jul 25 07:39:54 ylntest.yln.info systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Jul 25 07:39:54 ylntest.yln.info systemd[1]: httpd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit httpd.service has entered the 'failed' state with result 'exit-code'.
Jul 25 07:39:54 ylntest.yln.info systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jul 25 07:39:54 ylntest.yln.info sudo[215986]: pam_unix(sudo:session): session closed for user root
Jul 25 07:40:33 ylntest.yln.info sudo[216223]: administrator : TTY=pts/0 ; PWD=/etc/openldap ; USER=root ; COMMAND=/bin/journalctl -xe
Jul 25 07:40:33 ylntest.yln.info sudo[216223]: pam_unix(sudo:session): session opened for user root by administrator(uid=0)
Jul 25 07:41:07 ylntest.yln.info sudo[216223]: pam_unix(sudo:session): session closed for user root
Jul 25 07:41:20 ylntest.yln.info sudo[216509]: administrator : TTY=pts/0 ; PWD=/etc/httpd/conf.d ; USER=root ; COMMAND=/bin/mv php.conf.old php.conf
Jul 25 07:41:20 ylntest.yln.info sudo[216509]: pam_unix(sudo:session): session opened for user root by administrator(uid=0)
Jul 25 07:41:20 ylntest.yln.info sudo[216509]: pam_unix(sudo:session): session closed for user root
Jul 25 07:41:36 ylntest.yln.info sudo[216609]: administrator : TTY=pts/0 ; PWD=/etc/httpd/conf.d ; USER=root ; COMMAND=/bin/systemctl restart httpd
Jul 25 07:41:36 ylntest.yln.info sudo[216609]: pam_unix(sudo:session): session opened for user root by administrator(uid=0)
Jul 25 07:41:36 ylntest.yln.info systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit httpd.service has begun starting up.
Jul 25 07:41:36 ylntest.yln.info httpd[216612]: [Tue Jul 25 07:41:36.377257 2023] [so:warn] [pid 216612] AH01574: module php_module is already loaded, skipping
Jul 25 07:41:36 ylntest.yln.info systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Jul 25 07:41:36 ylntest.yln.info systemd[1]: httpd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit httpd.service has entered the 'failed' state with result 'exit-code'.
Jul 25 07:41:36 ylntest.yln.info systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jul 25 07:41:36 ylntest.yln.info sudo[216609]: pam_unix(sudo:session): session closed for user root
Jul 25 07:41:45 ylntest.yln.info sudo[216670]: administrator : TTY=pts/0 ; PWD=/etc/httpd/conf.d ; USER=root ; COMMAND=/bin/journalctl -xe
Jul 25 07:41:45 ylntest.yln.info sudo[216670]: pam_unix(sudo:session): session opened for user root by administrator(uid=0)

我同时拥有 php.conf 和 php81-php.conf,因此我将其重命名为 php.conf。它没有任何效果(并且它已经愉快地共存了一段时间)。

答案1

尝试使用以下命令来确保您的 Apache 配置有效。

apachectl configtest

另请检查您是否启用了 SELinux

sestatus

相关内容