Apacheの起動に失敗したらerror_logを見よう
1. 事象
Apache設定完了後、systemctl start httpdにて起動を試みたところ失敗した。
# systemctl start httpd
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xeu httpd.service" for details.
2. 初期調査
指示に従い、journalctlおよびsystemctl statusを確認。
# journalctl -xeu httpd.service
...
httpd.service: Referenced but unset environment variable evaluates to an empty string: OPTIONS
...
# systemctl status httpd
× httpd.service - The Apache HTTP Server
...
(httpd)[6679]: httpd.service: Referenced but unset environment variable evaluates to an empty string: OPTIONS
...
両方にOPTIONS環境変数未設定の旨が出力されていたため、これを主原因と推測。
3. エラーログの確認
念のため/var/log/httpd/error_logを確認。
# cat /var/log/httpd/error_log
[Thu Aug 14 20:23:31.683568 2025] [ssl:emerg] [pid 6679:tid 6679] AH02311: Fatal error initialising mod_ssl, exiting. See /etc/httpd/logs/ssl_error_log for more information
mod_sslの初期化で致命的エラーが発生していることが判明。
案内に従いssl_error_logを確認。
# cat /var/log/httpd/ssl_error_log
[Thu Aug 14 20:23:31.683505 2025] [ssl:emerg] [pid 6679:tid 6679] AH02572: Failed to configure at least one certificate and key for erogamescape.org:443
[Thu Aug 14 20:23:31.683562 2025] [ssl:emerg] [pid 6679:tid 6679] SSL Library Error: error:0A0000B1:SSL routines::no certificate assigned
原因は、SSL証明書および秘密鍵が正しく設定されていないことによるmod_sslの初期化失敗であった。
4. 教訓
-
systemctl statusやjournalctlの出力は必ずしも直接原因を示さない - Apache起動失敗時は、まず
/var/log/httpd/error_logを確認する