我无法设置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年。
以下是我的测试结果:
- 证书和私钥没有尾随空格。
- 我没有使用默认的Server.key文件。
- 我检查了nginx.conf,指令指向正确的私钥和证书。
我还检查了模数,我得到了密钥和证书的不同模数。
谢谢你的帮助。:)
17条答案
按热度按时间jobtbby316#
我遇到这个问题是因为我以错误的顺序添加了包和证书,所以这可能会对其他人有所帮助。
之前(这是错误的):
之后(这是正确的)
请不要忘记更新适当的配置文件(现在SSLCERTIFICATE必须指向链接的CRT)为
从nginx manpage:
如果服务器证书和捆绑包以错误的顺序连接,nginx将无法启动,并显示错误消息:
ibps3vxo17#
1.确保您的证书和密钥为PEM格式。如果不是,则使用openssl命令进行转换
1.检查公钥的MD5散列,以确保它与私钥中的内容匹配