今天在centos7中使用nginx+python部署了一个程序接口,并且添加了ssl证书验证,但是最后访问的时候使用浏览器访问 https://接口,可以正常访问,但是使用代码访问时会出问题,比如说使用python的requests库进行访问,requests.post('https://') 会出现 HTTPSConnectionPool: Max retries exceeded with url 问题,必须加上 verify=False才能够访问,请问可以通过修改服务器中的配置让程序(所有程序,不限于python)不设置忽略证书直接访问吗?
用 curl 命令可以正常请求吗?
使用curl 链接时会显示:
curl: (60) Peer's Certificate issuer is not recognized.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
请您看一下
@清洁人: 需要使用权威证书,现在主流的云服务商都提供了免费的 https 证书,或者使用 letsencrypt 生成证书
@dudu: 谢谢您,帮大忙了