我无法建立SSL。我在谷歌上搜索了几个解决方案,但没有一个对我有用。我需要帮助..。
下面是我试图重新启动nginx时遇到的错误:
root@s17925268:~# service nginx restart
Restarting nginx: nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/nginx/conf.d/ssl/ssl.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)
nginx: configuration file /etc/nginx/nginx.conf test failed
我的证书来自StartSSL,有效期为1年。
下面是我测试的内容:
我还检查了模数,得到了密钥和证书的不同模数。
谢谢你的帮助。:)
发布于 2014-10-07 00:17:00
我得到了一个对密钥和证书都有不同结果的MD5散列。
这说明了一切。您的密钥与证书不匹配。
模数应该匹配。确保你有正确的钥匙。
发布于 2015-03-06 07:43:10
一旦你确定它们不匹配,你仍然有一个问题--该怎么办。通常,证书可能只是不正确地组装。当CA签署您的证书时,它们会向您发送一个看起来类似于
-----BEGIN CERTIFICATE-----
MIIAA-and-a-buncha-nonsense-that-is-your-certificate
-and-a-buncha-nonsense-that-is-your-certificate-and-
a-buncha-nonsense-that-is-your-certificate-and-a-bun
cha-nonsense-that-is-your-certificate-and-a-buncha-n
onsense-that-is-your-certificate-AA+
-----END CERTIFICATE-----
他们还会向您发送一个包(通常是两个证书),它们代表了授予您证书的权限。这看起来就像
-----BEGIN CERTIFICATE-----
MIICC-this-is-the-certificate-that-signed-your-request
-this-is-the-certificate-that-signed-your-request-this
-is-the-certificate-that-signed-your-request-this-is-t
he-certificate-that-signed-your-request-this-is-the-ce
rtificate-that-signed-your-request-A
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICC-this-is-the-certificate-that-signed-for-that-one
-this-is-the-certificate-that-signed-for-that-one-this
-is-the-certificate-that-signed-for-that-one-this-is-t
he-certificate-that-signed-for-that-one-this-is-the-ce
rtificate-that-signed-for-that-one-this-is-the-certifi
cate-that-signed-for-that-one-AA
-----END CERTIFICATE-----
但不幸的是他们不会被这么清楚地贴上标签。
因此,一个常见的做法是将所有这些都打包到一个文件中--您的证书,然后是签名证书。但是由于它们不容易区分,有时会发生这样的情况:有人不小心把它们放在另一个顺序--签署证书,然后是最终证书--而没有注意到。在这种情况下,您的证书将与您的钥匙不匹配。
您可以通过运行以下命令来测试证书所代表的内容。
openssl x509 -noout -text -in yourcert.cert
在顶部附近,您应该看到"Subject:“以及类似于您的数据的内容。如果它看起来像您的CA,那么您的包可能是错误的;您可能尝试进行备份,然后将最后一个证书移到开头,希望这是您的证书。
如果这不起作用,你可能只需要重新颁发证书。当我做一个CSR时,我喜欢清楚地标记它用于什么服务器(而不仅仅是ssl.key或server.key),并用名称中的日期(比如mydomain.20150306.key等)复制它,这样它们的私钥和公钥对就不太可能与另一组混淆。
发布于 2014-10-04 19:06:11
https://stackoverflow.com/questions/26191463
复制相似问题