lsky-org / lsky-pro

☁️兰空图床(Lsky Pro) - Your photo album on the cloud.
https://www.lsky.pro
GNU General Public License v3.0
4.16k stars 612 forks source link

【Bug】存储单元使用Minio,链接地址使用域名就会出问题 #458

Closed codeboysky closed 10 months ago

codeboysky commented 2 years ago

存储方式使用Minio方式时,连接地址使用域名则实际访问的域名是https://桶名.域名 复现步骤:

首先修改了 vendor/league/flysystem-aws-s3-v3/AwsS3V3Adapter.php 代码用于帮助打印问题 image

先决条件: 连接地址使用域名:https://example.domain.com:7000,储存桶名称:lsky-pro,区域:us-east-1

日志: [2022-06-25 15:42:48] prod.ERROR: Web 上传文件时发生异常 {"file":"/var/www/html/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php","line":195,"message":"Error executing \"PutObject\" on \"https://lsky-pro.example.domain.com:7000/2022/06/25/62b6bc787de8e.png\"; AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target host name 'lsky-pro.example.domain.com' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://lsky-pro.example.domain.com:7000/2022/06/25/62b6bc787de8e.png","trace":"#0 /var/www/html/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php(97): Aws\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\Psr7\Request), Object(Aws\Command), Array)

1 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(204): Aws\WrappedHttpHandler->Aws\{closure}(Array)

2 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(169): GuzzleHttp\Promise\Promise::callHandler(2, Array, NULL)

3 /var/www/html/vendor/guzzlehttp/promises/src/RejectedPromise.php(42): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}(Array)

4 /var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise\{closure}()

5 /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(158): GuzzleHttp\Promise\TaskQueue->run()

6 /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(183): GuzzleHttp\Handler\CurlMultiHandler->tick()

7 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute(true)

8 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()

9 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()

wisp-x commented 2 years ago

可能和 php ssl 证书问题相关。 下载证书 https://curl.haxx.se/ca/cacert.pem,然后打开 php.ini 配置文件搜索关键字: curl.cainfoopenssl.cafileopenssl.capath,将这些配置替换成下载的证书路径。

参考链接:https://laracasts.com/discuss/channels/laravel/aws-http-error-curl-error-60-ssl-certificate-problem?page=1&replyId=494837

codeboysky commented 2 years ago

谢谢关注该问题,我已经按照指引调整了php的参数,但是问题依旧存在。 从日志中其实可以发现,正确的域名应该是example.domain.com:7000,但是代码却要求访问lsky-pro.example.domain.com,造成域名无法解析所以上传失败了

codeboysky commented 2 years ago

image

wwwzhouhui commented 1 year ago

@codeboysky 你的问题解决了没?如何解决的?

codeboysky commented 1 year ago

@codeboysky 你的问题解决了没?如何解决的?

我也没搞定,最后是使用了http,看网上说应该是minio的client包版本低了造成的,你可以试试升级下看看能搞定不

codeboysky commented 10 months ago

问题同 #683 @wwwzhouhui