curl 错误

curl 错误

我在使用 curl 时遇到以下错误:

curl https://www.google.com -v
* About to connect() to www.google.com port 443 (#0)
*   Trying 2607:f8b0:400e:c01::67...
* Failed to connect to 2607:f8b0:400e:c01::67: Network is unreachable
*   Trying 74.125.28.103...
* Adding handle: conn: 0x4041f868e0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x4041f868e0) send_pipe: 1, recv_pipe: 0
* Connected to www.google.com (74.125.28.103) port 443 (#0)
* error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* Closing connection 0

忽略网络不可达...每个 https:// url 都会发生这种情况,即使网络可达。

我不会手动安装证书,因为它应该自动获取它们...有什么想法吗?

答案1

修复。我不知道问题是什么,但它与证书(ca-certificates)包有关。

ca-certificates通过添加并运行已修复update-ca-certificates

我使用的发行版是 Alpine LInux,因此命令是:

apk add ca-certificates
update-ca-certificates

在 Debian 中它应该是:

apt-get install ca-certificates
update-ca-certificates

相关内容