minio 结合ng 报错The request signature we calculated does not match the signature you provided.

需求描述:小程序中需要访问图片,但是又不能直接访问minio的ip地址加端口的方式。只有通过ng来转发。小程序里面必须通过域名的方式才能访问接口或者图片。

正常通过ip加端口是能访问minio的图片。通过ng后就报错意思就是验证不通过访问图片。大概的原因应该是ng转发后的header有什么问题。

我是去掉了ng配置中的proxy_set_header Host 这个设置。加了proxy_redirect off;

全局配置如下:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        #https访问minio的端口号
         listen    8079 default_server ssl;
        server_name www.test.com;
        #证书文件名称
        ssl_certificate /cqec/miniong/sslkey/scs1672901853997_www.test.com_server.crt;
        #私钥文件名称
        ssl_certificate_key /cqec/miniong/sslkey/scs1672901853997_www.test.com_server.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        charset utf-8,gbk;

        location /{
                #minio的ip地址加端口
                proxy_pass http://123.7.*.*:9000;
                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_http_version 1.1;
                proxy_set_header Connection "";
                chunked_transfer_encoding off;
                proxy_intercept_errors on;
                proxy_connect_timeout 300;
                proxy_redirect off;
                expires 7d;
                add_header XCDN-Cache "$upstream_cache_status";
         }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
报错信息"The request signature we calculated does not match the signature you provided. Check your key and signing method."通常是因为连接MinIO时密钥或签名方法不匹配引起的。可以按照以下解决方案来解决该问题: 1. 首先,确认你的密钥是否正确。检查你在连接MinIO时提供的访问密钥和秘钥是否准确无误。 2. 确保你在生成请求签名时使用了正确的签名方法。MinIO支持多种签名方法,比如AWS Signature Version 4、AWS Signature Version 2等。确保你在生成请求时使用了与MinIO服务器兼容的签名方法。 3. 当连接MinIO时,确保你的请求中的签名信息与服务器预期的签名信息一致。如果你的请求在传输过程中被修改或篡改,可能会导致签名不匹配的错误。确保你的请求在传输过程中没有被篡改。 4. 如果以上解决方案都无法解决你的问题,可以参考MinIO的官方文档,查找更多关于此错误的信息和解决方案。官方文档可能包含更多针对特定情况的解决方案,能够更好地帮助你解决问题。 希望以上解决方案能够帮助你解决问题。如果你仍然遇到困难,建议你提供更多细节或错误日志,以便我们更好地帮助你解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [java程序连接MinIO 报错The request signature we calculated does not match the signature you provided.](https://blog.csdn.net/weixin_46714330/article/details/128002769)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [java程序连接MinIO报错The request signature we calculated does not match the signature you provided.](https://blog.csdn.net/weixin_44299027/article/details/131192641)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值