连接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

哪位大佬帮忙看看

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

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