且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Curl:修复 CURL (51) SSL 错误:没有替代证书主题名称匹配

更新时间:2023-01-02 10:20:22

通常发生在证书与主机名不匹配时.

It usually happens when the certificate does not match with the host name.

解决方案是联系主机并要求其修复其证书.
否则,您可以关闭 cURL 对证书的验证,使用 -k(或 --insecure)选项.
请注意,正如选项所说,它不安全.您不应使用此选项,因为它允许中间人攻击并违背 HTTPS 的目的.

The solution would be to contact the host and ask it to fix its certificate.
Otherwise you can turn off cURL's verification of the certificate, use the -k (or --insecure) option.
Please note that as the option said, it is insecure. You shouldn't use this option because it allows man-in-the-middle attacks and defeats the purpose of HTTPS.

更多可以在这里找到:http://curl.haxx.se/docs/sslcerts.html