AH02565 の修正方法: 証明書と秘密鍵が一致しません

AH02565 の修正方法: 証明書と秘密鍵が一致しません

Ubuntu Apache サーバーでホストされているアプリケーションがあり、そこに Letsencrypt SSL がインストールされています。今、Letsencrypt SSL 証明書を Digicert 証明書に変更したいと考えています。Digicert SSL インストール ドキュメントに従いましたが、Apache サーバーを起動しようとすると失敗します。エラー ログを確認した後、以下のエラーが見つかりました。

AH02565: Certificate and private key urbaninspirations.biz:443:0 from /etc/cert/domain_name.crt and /etc/cert/domain_name.key do not match
AH00016: Configuration Failed

以下は私の「000-default-le-ssl.conf」ページスクリプトです

<VirtualHost *:443>
    ServerName domain_name.biz
    ServerAlias www.domain_name.biz
    SSLEngine On
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    
    ### This is using in Letsencrypt SSL certificates
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/domain_name.biz/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/domain_name.biz/privkey.pem

    ### Change this for DigiCert SSL certification but getting error when enable below line
    #SSLCertificateFile /etc/cert/domain_name.crt
    #SSLCertificateKeyFile /etc/cert/domain_name.key
    #SSLCertificateChainFile /etc/cert/DigiCertCA.crt
</VirtualHost>

私が何を間違っているのか、正しい方向を指し示してくれる人はいますか?

答え1

秘密鍵は、使用する証明書(の公開鍵)と一致している必要があります。一致していない場合は、一緒に使用することはできません。

キーと証明書の両方が一致していることを確認する 1 つの方法 (証明書は使用されている秘密キーから取得されます) は、openssl を使用してそれらの係数をチェックすることです。

openssl rsa -in file.key -noout -modulus

openssl x509 -in file.crt -noout -modulus

Note: If certificate or key are not in ASCII you must add "-inform DER" to the specific file.

両方のコマンドの出力は同じである必要があります。

関連情報