更多ruoyi-nbcio功能请看演示系统
gitee源代码地址
前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio
演示地址:RuoYi-Nbcio后台管理系统
用java程序上传minio文件时候出现下面前端报上面的错误
创建Bucket失败, 请核对配置信息:[The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 17997C8E8553FD5A; S3 Extended Request ID: f295cb55-b4ca-4821-a685-982f66bda3e9; Proxy: null)]
后端报下面的错误
2023-11-21 08:41:25[0;39m [32m[XNIO-1 task-1][0;39m [1;31mERROR[0;39m [1;35mc.r.f.w.e.GlobalExceptionHandler [0;39m - 请求地址'/system/oss/upload',发生未知异常. com.ruoyi.oss.exception.OssException: 创建Bucket失败, 请核对配置信息:[The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 17997C8E8553FD5A; S3 Extended Request ID: f295cb55-b4ca-4821-a685-982f66bda3e9; Proxy: null)] at com.ruoyi.oss.core.OssClient.createBucket(OssClient.java:92) at com.ruoyi.oss.core.OssClient.<init>(OssClient.java:71) at com.ruoyi.oss.factory.OssFactory.instance(OssFactory.java:50) at com.ruoyi.oss.factory.OssFactory.instance(OssFactory.java:36) at com.ruoyi.system.service.impl.SysOssServiceImpl.upload(SysOssServiceImpl.java:125) at com.ruoyi.system.service.impl.SysOssServiceImpl$$FastClassBySpringCGLIB$$8fa643de.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
根据minio的官方网站,对于nginx需要做调整
为 MinIO 服务器配置 NGINX 代理 — MinIO Object Storage for Linux
upstream minio { least_conn; server minio-01.internal-domain.com; server minio-02.internal-domain.com; server minio-03.internal-domain.com; server minio-04.internal-domain.com; } server { listen 80; listen [::]:80; server_name minio.example.net; # Allow special characters in headers ignore_invalid_headers off; # Allow any size file to be uploaded. # Set to a value such as 1000m; to restrict file size to a specific value client_max_body_size 0; # Disable buffering proxy_buffering off; proxy_request_buffering off; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 300; # Default is HTTP/1, keepalive is only enabled in HTTP/1.1 proxy_http_version 1.1; proxy_set_header Connection ""; chunked_transfer_encoding off; proxy_pass https://minio:9000/; # This uses the upstream directive definition to load balance } location /minio { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-NginX-Proxy true; # This is necessary to pass the correct IP to be hashed real_ip_header X-Real-IP; proxy_connect_timeout 300; # To support websockets in MinIO versions released after January 2023 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; chunked_transfer_encoding off; proxy_pass https://minio:9001/; # This uses the upstream directive definition to load balance and assumes a static Console port of 9001 } }