问题描述

使用Nginx给minio做端口代理转发 进入管理界面查看桶一直显示loading问题

up-8d9eb115fce31f15516399fadac7db71b7b.png

问题原因

按F12查看了一下,查看桶发起的是 websocket 请求。

解决方案:

在 nginx配置 上加上websocket支持

# 添加了websocket支持
proxy_http_version      1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
proxy_set_header        Host  $http_host;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

我的完整配置

server {
        listen  80;
        server_name     console.minio.summergao.com;
        location / {
            proxy_pass      http://0.0.0.0:37382; # 端口转发

            # 添加了websocket支持
            proxy_http_version      1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
            proxy_set_header        Host  $http_host;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

        }
    }

    server {
        listen  80;
        server_name     minio.summergao.com;
        location / {
            proxy_pass      http://0.0.0.0:9000; # 端口转发

            # 添加了websocket支持
            proxy_http_version      1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
            proxy_set_header        Host  $http_host;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

记得重载nginx配置才生效

./nginx -s reload 

 

 

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐