连接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
哪位大佬帮忙看看
推荐文章: