apacheの起動が失敗し、表示通りに systemctl status httpd.service 、journalctl -xe しても原因がわからない場合は、エラーログの方を確認してみてください。
# 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.
例えば、こちらでは systemctl status httpd.service 、journalctl -xe を実行しても、以下のようにapacheが起動失敗した原因がわかりませんでした。
# 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 金 2022-03-11 16:19:15 JST; 25s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 27974 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 619 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 619 (code=exited, status=1/FAILURE)
3月 11 16:19:15 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
3月 11 16:19:15 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
3月 11 16:19:15 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
3月 11 16:19:15 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
3月 11 16:19:15 localhost.localdomain systemd[1]: httpd.service failed.
# journalctl -xe
:
:
-- Subject: Unit user-0.slice has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished starting up.
--
-- The start-up result is done.
3月 11 16:20:01 localhost.localdomain systemd[1]: Started Session 170 of user root.
-- Subject: Unit session-170.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-170.scope has finished starting up.
--
-- The start-up result is done.
3月 11 16:20:01 localhost.localdomain CROND[764]: (root) CMD (/usr/lib64/sa/sa1 1 1)
3月 11 16:20:01 localhost.localdomain systemd[1]: Removed slice User Slice of root.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished shutting down.
ここで、エラーログの方を確認してみると、「Server should be SSL-aware but has no certificate configured」の文字が。
# less /var/log/httpd/error_log
:
:
[Fri Mar 11 16:19:15.539932 2022] [suexec:notice] [pid 619] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Mar 11 16:19:15.540286 2022] [ssl:emerg] [pid 619] AH02240: Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] (/etc/httpd/conf.d/gitlab.conf:12)
[Fri Mar 11 16:19:15.540293 2022] [ssl:emerg] [pid 619] AH02312: Fatal error initialising mod_ssl, exiting.
SSLがONになっているのに、証明書設定が無いようです。
確認すると、SSLCertificateFile, SSLCertificateKeyFile が設定されていませんでした。
この2つを記述したら起動OKになりました。
コメント