公司的一個域名,用瀏覽器打開能正常訪問,可是在linux下使用curl命令,老是報錯,報錯信息以下:html
curl: (60) Peer certificate cannot be authenticated with known CA certificates 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.
網上搜了下這個報錯信息,花了一天的時間竟然仍是沒能解決。 python
後來偶然搜索ssl,打開了一個ssl檢測網站(能檢測https證書是否正常的一個網站),放上連接:https://myssl.com/ 檢測後發現公司的這個域名https證書有問題:好像是"證書鏈不完整"之類的信息.linux
因而乎接着百度,google搜索證書鏈不完整的相關結果,終於發現瞭解決方法。nginx
用另一個網站生產中間證書: https://www.myssl.cn/tools/downloadchain.html(該網站能夠在線生產中間證書)瀏覽器
生產中間證書以後,把中間證書的內容完徹底全的複製並追加到crt/cer文件後面(不要有空格,空行)dom
以後重載nginx配置文件,發現curl 命令再也不報錯,至此,問題應該獲得瞭解決,只是還不清楚其中的因此然,有時間了再研究吧。curl