当前位置: 首页 > 知识库问答 >
问题:

cURL错误60:SSL证书问题:证书已过期

裘丰
2023-03-14

我们在amazon ec2(backend.abc.com和frontend.abc.com)上运行2个应用程序。对于该应用程序,我们使用了付费SSL证书。该证书的有效期为2021年6月。但今天,我们犯了一个错误-

cURL error 60: SSL certificate problem: certificate has expired (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

我们检查证书到期日期,但没有问题(2021年6月)。然后我们关注以下问题:Thread-curl:(60)SSL证书问题:无法获得本地颁发者证书(@Dahomz回答)

之后,当我们通过-curl-v--URL https://backend.abc.com--cacert/etc/ssl/ssl.cert/cacert.pem来curl abc.com时,它可以正常工作。反应类似-

* Rebuilt URL to: https://backend.abc.com/
*   Trying 127.0.0.1...
* Connected to backend.abc.com (127.0.0.1) port 443 (#0)
* found 139 certificates in /etc/ssl/ssl.cert/cacert.pem
* found 600 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ******_RSA_***_***_GCM_*****
*    server certificate verification OK
*    server certificate status verification SKIPPED
*    common name: *.abc.com (matched)
*    server certificate expiration date OK
*    server certificate activation date OK
*    certificate public key: RSA
*    certificate version: #3
*    subject: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.abc.xyz
*    start date: Mon, 04 May 2019 00:00:00 GMT
*    expire date: Wed, 07 June 2021 23:59:59 GMT
*    issuer: C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Limited,CN=Sectigo RSA Domain Validation Secure Server CA
*    compression: NULL
* ALPN, server accepted to use http/1.1

但是当我们用卷曲从frontend.abc.com到backend.abc.com时,它会抛出这个错误-

* Rebuilt URL to: https://backend.abc.com/
*   Trying 127.0.0.1...
* Connected to backend.abc.com (127.0.0.1) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/ssl.cert/cacert.pem
  CApath: /etc/ssl/certs
* SSL connection using TLSv1.2 / *****-RSA-*****-GCM-******
* ALPN, server accepted to use http/1.1
* Server certificate:
*    subject: OU=Domain Control Validated; OU=PositiveSSL Wildcard; CN=*.abc.com
*    start date: Mar  4 00:00:00 2019 GMT
*    expire date: Apr  7 23:59:59 2021 GMT
*    issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
*    SSL certificate verify result: certificate has expired (10), continuing anyway.

我的卷曲码-

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://backend.abc.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_STDERR, fopen(public_path("c.log"), 'w'));
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$output = curl_exec($ch);
$error = curl_error($ch);
$info = curl_getinfo($ch);
curl_close($ch);

共有1个答案

柯永福
2023-03-14

若要解决此问题,请从域证书中删除过期的根证书。

  1. 转到https://whatsmychaincert.com
  2. 测试服务器
  3. 如果他们确认您拥有过期的根证书,请下载并使用不带此证书的.crt。

(可选)当您这样做的时候,您可以使用这个临时卷曲修复,以避免在您的网站上出现错误:添加这个选项:

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
 类似资料:
  • 我快被这个问题弄疯了。我在Laravel上有两个站点在https上互相调用(用OAUTH2登录,passport/sociate)。两者都安装在我的本地开发服务器上,在MAMP,MAMP自动签名的证书。 我到处都能找到这个解决方案:把cacert.pem文件放在某个地方,把路径写在php.ini中 完成,Apache重新启动,设置正确地出现在两个站点的phpinfo()中。然而,错误依然存在。有人

  • 我在本地开发环境中使用 WAMP,并尝试发送邮件,但收到错误消息: 异常:“SendinBlue\Client\ApiException” 文件:“\vendor\sendinblue\api-v3-sdk\lib\api\SMTPApi.php” 线:3986 消息:"[0]cURL错误60: SSL证书问题:无法获取本地颁发者证书(见https://curl.haxx.se/libcurl/c

  • 问题内容: 我尝试将带有正确APP_ID,APP_SECRET等的curl请求发送到 我需要从中获取access_token,但需要返回FALSE并打印下一条消息: 我的代码是: 当我手动移动到上面的链接时,我会很好地获得access_token。为什么卷曲不起作用?请帮助。 问题答案: 建议禁用的答案不被接受。问题是“为什么它不适用于cURL”,正如Martijn Hols正确指出的那样,这很危

  • 我正在尝试使用< code>Amazon SDK for php,从运行< code>AppServ 2.5.10(包括< code>Apache 2.2.8 、< code>php 5.2.6 、< code>mysql 5.0.51b和< code>phpMyAdmin 2.10.3)的(localhost) Windows 8机器上连接亚马逊的S3文件。 为了兼容< code>Amazon

  • 问题内容: 我在本地开发环境上使用WAMP,并尝试从信用卡中扣款,但收到错误消息: cURL错误60:SSL证书问题:无法获取本地颁发者证书 我在Google上进行了很多搜索,很多人建议我下载此文件:cacert.pem,将其放在某个位置,然后在php.ini中引用它。这是我的php.ini中的部分: 但是,即使多次重新启动服务器并更改了路径后,我仍然收到相同的错误消息。 我使用来自Apache模