Woocommerce Webshop on bitnami stack (ec2): SSL operation failed with code 1. OpenSSL Error messages: error:14090086

Woocommerce Webshop on bitnami stack (ec2): SSL operation failed with code 1. OpenSSL Error messages: error:14090086

我实在找不到解决办法。我将带有 woocommerce 商店和支付网关 "Payunity" 的 Wordpress 站点迁移到带有 bitnami wordpress 堆栈的新 EC2 机器。 我生成了 Let's Encrypt SSL 证书,整个网站都按预期工作。

我唯一的问题是,出于某种原因,我在 woocommerce 结帐页面上突然收到此错误消息:

SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

我在谷歌上进行了大量搜索,并尝试解决这个问题,但没有机会。

知道我必须在服务器上设置什么才能消除这种情况吗?我尝试像一些线程指出的那样用 capath 和 cafile 修改 php.ini 但没有运气。

有什么想法吗?

更新:我现在作为 DNS 管理器移至 Cloudflare 并具有“完全(严格)”设置,以便 Cloudflare SSL 是正在使用的 SSL。但是仍然是同样的错误,所以我认为这与原始的 Let's Encrypt 或现在的 Cloudflare SSL 证书无关。

我认为此错误消息是由 CURL 引起的。根据 CURL 常见问题解答 (https://github.com/curl/curl/blob/master/docs/FAQ) 第 4.12 节(其中提到了此错误消息),"it means that curl couldn't verify that the server's certificate was good. Curl verifies the certificate using the CA cert bundle that comes with the curl installation."(相对于 CURL 7.10).

因为你的 CURL 版本很旧(released on Oct 7, 2015), I would assume that one of the CA/root certificates it is using is too old. I would recommend updating CURL separately (e.g. using this guide: http://pavelpolyakov.com/2014/11/17/updating-php-curl-on-ubuntu/,取决于你的 OS)。 此外,您可以检查 php.ini 中的 openssl.cafile 选项,该选项应指向包含或多或少最近的 CA 捆绑包的绝对路径(例如 "C:\xampp7.3\apache\bin\curl-ca-bundle.crt" 用于我的 XAMPP 安装)。您可以尝试从 XAMPP .zip (https://www.apachefriends.org/download.html) 中提取包并替换 php.ini 中的路径,然后重新启动服务器。

此外,您可以检查您的 php.ini 是否 extension=php_openssl.*(Windows 的 dll 的扩展名)未被注释,即已激活。

也许(这就是为什么我问应该在这个地方正常显示什么)Payunity 插件中的脚本正试图从 URL 中获取某些证书损坏的东西或其他东西相似。

编辑: 正如 Sebastian B. 所指出的,您可以检查 error.log(如果是 Apache)是否失败 file_get_contents()(或类似) 调用是因为那里提到了 "file" 站点 PHP 试图获取的实际 URL。

编辑: CURL Perl 脚本创建一个新的 ca-bundle.crt 文件基于 Mozilla 的链:https://github.com/curl/curl/blob/master/lib/mk-ca-bundle.pl You can try this (or extract one from a fresh CURL installation) and set this as a path in php.ini. Or you can use this from the Nextcloud project (https://github.com/nextcloud/server/blob/master/resources/config/ca-bundle.crt) 或另一个 (当然只是为了测试目的)。