报错信息如下:
Starting nginx... nginx: [emerg] cannot load certificate "/usr/local/nginx/cert/aa.key": PEM_read_bio_X509_AUX() failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE)
这个情况是配置网站conf里面的内容出错了,先检查
# 指定 ssl 证书路径
ssl_certificate /usr/local/nginx/cert/aa.pem;
# 指定私钥文件路径
ssl_certificate_key /usr/local/nginx/cert/aa.key;
最后贴上一段nginx配置SSL的设置,http跳转到https的设置办法
# 监听 ssl 443 端口
listen 443 ssl;# 开启 ssl
#ssl on;
# 指定 ssl 证书路径
ssl_certificate /usr/local/nginx/cert/aa.pem;
# 指定私钥文件路径
ssl_certificate_key /usr/local/nginx/cert/aa.key;
#让http请求重定向到https请求
if ($server_port = 80) {
return 301 https://$server_name$request_uri;
}
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
error_page 497 https://$server_name$request_uri;
文章来源于网络或者作者投稿,若有侵权请联系删除,作者:老钟,如若转载,请注明出处:https://www.laoz.net/1093.html