如何修复 AH02565:证书和私钥不匹配

Pau*_*aul 3 apache-2.4 ubuntu-14.04

我们有一个托管在 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
Run Code Online (Sandbox Code Playgroud)

下面是我的“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>
Run Code Online (Sandbox Code Playgroud)

有人能为我指出我做错的事情的正确方向吗?

ezr*_*a-s 11

私钥必须与您使用的证书(的公钥)匹配。否则你将无法一起使用它们。

确保密钥和证书匹配(证书来自正在使用的私钥)的一种方法是使用 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.
Run Code Online (Sandbox Code Playgroud)

两个命令的输出必须相同。