我遇到一个奇怪的问题,CURL 无法连接到它自己的服务器。例如,如果我在服务器上example.com
wget https://example.com/ <--- WORKS FIND
curl https://example.com gets error: 35 SSL connect error
Curl 适用于连接到其他外部 SSL 地址,但不会连接到自身。
curl 还可以在没有 SSL 的情况下连接自身。
这是curl -v 的输出:
curl -v https://example.com/
* About to connect() to example.com port 443 (#0)
* Trying 50.70.60.100... connected
* Connected to example.com (50.70.60.100) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* NSS error -12286
* Error in TLS handshake, trying SSLv3...
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: example.com
> Accept: */*
>
* Connection died, retrying a fresh connect
* Closing connection #0
* Issue another request to this URL: 'https://example.com/'
* About to connect() to example.com port 443 (#0)
* Trying 50.70.60.100... connected
* Connected to example.com (50.70.60.100) port 443 (#0)
* TLS disabled due to previous handshake failure
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* NSS error -12286
* Closing connection #0
* SSL connect error
curl: (35) SSL connect error