使用CURL请求HTTPS页面时指定IP

一般在使用CURL请求自定义IP地址并且指定HOST的话可以这样 curl http://127.0.0.1/ -H 'Host: moonagic.com' 但是如果你需要请求的地址是HTTPS的就不行了, curl [IP]:443 -H 'Host:moonagic.com' curl: (52) Empty reply from server curl https://[IP]:443 -H 'Host:moonagic.com' curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://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. »

Author image 月杪 on #curl,