curl 和 python 代码访问 https服务出现 SSL certificate problem: unable to get local issuer certificate 的错误

curl 和 python 访问 let's encrypt 申请的 SSL 证书的 https 服务, 出现证书验证失败的错误提示 unable to get local issuer certificate。但是在 chrome 浏览器上访问,证书是正常的。

curl https://chatty.xyz.com

出现这个错误:

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

排查了好久,最后偶然发现另外的域名是可以正常访问的。 于是到服务器上检查了一下配置,发现原来是 nginx 里面的 ssl_certificate 配置错文件了, 应该用 fullchain.pem,写成了 cert.pem。配置的时候只测试了浏览器可以正常访问,浏览器上显示证书是绿色,没发现这个问题。

#ssl_certificate /etc/letsencrypt/live/chatty.xyz.com/cert.pem;

ssl_certificate /etc/letsencrypt/live/chatty.xyz.com/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/chatty.xyz.com/privkey.pem;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值