Nginx SSL 失败,需要任何私钥

Nginx SSL 失败,需要任何私钥

我在配置 SSL 以用于 nginx 时遇到了问题。我不确定如何解决这个问题,有没有人知道解决方案或可以为我指明正确的方向?

错误

nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/nginx/ssl/test.key") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: ANY PRIVATE KEY error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib)

nginx 配置

listen   443 ssl;
ssl_certificate       /etc/nginx/ssl/test.crt;
ssl_certificate_key   /etc/nginx/ssl/test.key;

ausearch -m avc -ts 今天 | audit2allow

#============= httpd_t ==============

#!!!! This avc is allowed in the current policy
allow httpd_t user_home_t:file read;

答案1

尝试使用 certbot 的 LetsEncrypt SSL 进行配置。有关更多信息,请参见此处: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04

如果您想要自签名证书,请单击此处: https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-in-ubuntu-18-04

相关内容