如何修復 AH02565:憑證和私鑰不匹配

如何修復 AH02565:憑證和私鑰不匹配

我們有一個託管在 Ubuntu apache 伺服器上的應用程序,並在那裡安裝了 LetsEncrypt SSL。現在我想用 Digicert 憑證來變更 Letsencrypt ssl 憑證。我按照 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

私鑰必須與您使用的憑證(的公鑰)相符。否則你將無法一起使用它們。

確保金鑰和憑證匹配(憑證來自正在使用的私鑰)的一種方法是使用 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.

兩個命令的輸出必須相同。

相關內容