CA 证书

1.ubuntu curl 命令报错(CA)

kamil@vm-ubuntu:~$ curl https://szxyzs.vanke.com/DataCenter/datacenter/api
curl: (60) SSL certificate problem: unable to get local issuer certificate
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.
kamil@vm-ubuntu:~$ 

原因:

此问题的出现是由于没有配置信任的服务器HTTPS验证。默认,cURL被设为不信任任何CAs,就是说,它不信任任何服务器验证。因此,这就是浏览器无法通过HTTPs访问你服务器的原因。当此问题出现时,网络程序员最好的办法是充分指定一组默认的受信任CAs,前提是你已经从这些CAs中购买过证书。
如果你的内容不敏感,一个快捷的方法是使用curl_exec()之前跳过ssl检查项:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
公众号请关注:侠之大者
原文地址:https://www.cnblogs.com/kamil/p/5466181.html