在window中nginx安装腾讯云ssl报错nginx: [emerg] cannot load certificate

在Windows环境中配置nginx时遇到了加载SSL证书失败的问题,错误提示为BIO_new_file()失败。解决方案是检查证书路径是否正确,将路径改为相对nginx配置文件的路径,并更新配置为新版语法:listen 443 ssl。此外,还提醒了旧版ssl配置的弃用,建议使用新语法。
摘要由CSDN通过智能技术生成

在配置window下的nginx的时候出现了

nginx: [emerg] cannot load certificate "C:/ssl/1_flyrun.work_bundle.crt": BIO_ne
w_file() failed (SSL: error:02001003:system library:fopen:No such process:fopen(
'C:/ssl/1_flyrun.work_bundle.crt','r') error:2006D080:BIO routines:BIO_new_file:
no such file)

首先nginx在windows配置腾讯云的openssl模块是已经安装好的,所以不需要考虑是ssl模块未安装

其次发现这里的地址出现了问题,应该是搜寻nginx文件下的ssl文件夹下的ssl配置文件,所以对nginx进行以下的调整

    server {
        listen       443 ssl;
        server_name  域名地址;

        ssl_certificate      ../ssl/1_域名_bundle.crt;
        ssl_certificate_key  ../ssl/2_域名.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }

需要注意当错误为

nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" direct
ive instead in C:\nginx-1.19.1/conf/nginx.conf:146

新版本的ssl配置为listen 443 ssl;

旧版本为

listen 443;

ssl on;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值