minio控制台nginx的配置注意事项
1.由于在查看对象列表的时候需要使用到ws协议,所以需要配置 location块支持ws协议
2.location块 proxy_set_header Host $http_host,而不是$host,前者带端口号,后者不带,会造成 ws协议请求出现403的问题
http块的配置中添加:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
或者:
#自定义变量 $connection_upgrade
map $http_upgrade $connection_upgrade {
default keep-alive; #默认为keep-alive 可以支持 一般http请求
'websocket' upgrade; #如果为websocket 则为 upgrade 可升级的。
}
server块的配置
server {
# minio;
# ali.dev.alongo.top:19001;
# 39.98.174.240:19001;
listen 19001 ssl http2;
ssl_certificate /home/nginxWebUI/mycert/server.crt;
ssl_certificate_key /home/nginxWebUI/mycert/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
if ($scheme = http) {
return 301 https://$host:19001$request_uri;
}
error_page 497 https://$host:$server_port$request_uri;
location / {
# minio;
proxy_pass http://127.0.0.1:9001;
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-Host $http_host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http:// https://;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Cookie $http_cookie;
}
}