连接elastic报错:cURL error 60: SSL certificate problem: self signed certificate in certificate chain

1. 运行环境

1). 当前使用的 Laravel 版本?

9.52.16

2). 当前使用的 php版本?

PHP 版本:

8.0
并且配置ssl证书
curl.cainfo =D:\BtSoft\nginx\conf\ssl\xyh-demo.com\cacert-2024-07-02.pem

3). es版本?

8.12.0

4).环境

windows开发环境

2. 问题描述?

es开启了安全验证:需要ssl和账号密码验证
目前使用postman请求是正常的,但是在laravel里面和本地curl请求都是证书问题,错误和代码如下:

#代码
$config = config('elasticsearch');
$es = ESClientBuilder::create()->setBasicAuthentication($config['username'],$config['password'])->setHosts([$config['hosts']])->build();
$data = $es->indices()->exists(['index'=>'test']);
dd($data);
#错误
GuzzleHttp\Exception\RequestException : cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://elastic:***@127.0.0.1:9200/test

哪位大佬帮忙看看

《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!