
私の SSL 仮想ホストは次のようにシンプルです。
LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost *:443>
DocumentRoot "/srv/www/test"
ServerName <my_website_domain>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>
Apache を再起動しようとすると、次のメッセージが表示されますapache2ctl configtest && systemctl restart apache2
。
構文 OK
制御プロセスがエラー コードで終了したため、apache2.service のジョブが失敗しました。詳細については、「systemctl status apache2.service」および「journalctl -xe」を参照してください。
しかし、SSLEngine をオフにすると、SSLEngine off
Apache は正常に起動します。
systemctl status apache2
で開始した後に実行するとSSLEngine on
、次のようになります:
Syntax OK
● apache2.service - The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-08-14 18:06:55 CEST; 1min 9s ago
Process: 22352 ExecStop=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful-stop (code=exited, status=0/SUCCESS)
Process: 19851 ExecReload=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful (code=exited, status=0/SUCCESS)
Process: 22346 ExecStart=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k start (code=exited, status=1/FAILURE)
Main PID: 22346 (code=exited, status=1/FAILURE)
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351148 2020] [so:warn] [pid 22352] AH01574: module authn_core_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351163 2020] [so:warn] [pid 22352] AH01574: module authz_core_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351170 2020] [so:warn] [pid 22352] AH01574: module php5_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351179 2020] [so:warn] [pid 22352] AH01574: module ssl_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.352998 2020] [so:warn] [pid 22352] AH01574: module ssl_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.356261 2020] [core:warn] [pid 22352] AH00117: Ignoring deprecated use of DefaultType in line 143 of /etc/apa.../httpd.conf.
Aug 14 18:06:55 luu056d start_apache2[22352]: httpd (no pid file) not running
Aug 14 18:06:55 luu056d systemd[1]: Failed to start The Apache Webserver.
Aug 14 18:06:55 luu056d systemd[1]: apache2.service: Unit entered failed state.
Aug 14 18:06:55 luu056d systemd[1]: apache2.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
httpd (no pid file) not running
をオンにすると、なぜそのエラーが発生するのでしょうかSSLEngine
?
実行するとlsof -i :443
結果が空になるため、ポート 443 をブロックするものは何もありません。
Linux/SUSEではApache/2.4.23を使用しています
答え1
これは証明書に問題があることを示しています。httpd は証明書をロードできないため、正常に起動できません。通常、SSL のエラー ログのレベルが高くない限り、これらのエラーは表示されません。LogLevel ssl:trace8
テスト用に設定し、動作するようになったら削除してください。
証明書が PEM 形式 (ASCII) であり、互いに一致しており、指定したパスに存在することを確認します。
openssl x509 -in /etc/ssl/certs/apache-selfsigned.crt -noout -modulus
openssl rsa -in /etc/ssl/private/apache-selfsigned.key -noout -modulus
両方のコマンドの出力は同じ結果を返す必要があります。そうでない場合は、正しくありません。
答え2
回答してくださった他の皆様に感謝申し上げますが、問題はファイルにありましたssl-globals.conf
。
これら2つのディレクティブはApacheをクラッシュさせていました
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
コメントしたところ、今は機能しています。理由はわかりませんが、科学は証拠に基づいています。