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

관련 정보