minio将http改为https方式访问

https://codeleading.com/article/56205149993/

 

由于项目更新成了https的访问方式,原来http格式的图片就无法在https页面中显示,查看minio官网的升级TLS方式没有解决

https://docs.min.io/cn/how-to-secure-access-to-minio-server-with-tls.html
  • 1

尝试使用nginx反向代理方式解决了.解决方法如下:
修改nginx.conf配置文件


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
upstream minio_server {
        server  yourIp:9000;
        ip_hash;
    }
    #gzip on 
       
   server {
listen       80;
server_name  域名名称或ip地址;
重定向到https请求
location / {
}

}
server {
#https访问minio的端口号
    listen    9001 ssl;
    server_name 域名名称/IP;
ssl_certificate  ./1_bundle.crt;#腾讯云申请的ssl证书crt文件所在位置
ssl_certificate_key  ./2_.key;#腾讯云申请的ssl证书key文件所在位置
ssl_session_timeout  60m; # session有效时间10分钟
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; # 按照这个套件配置
ssl_prefer_server_ciphers on; 
   location /{
       proxy_pass http://minio_server;
       proxy_set_header  Host       $host;
       proxy_set_header  X-Real-IP    $remote_addr;
       proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

  
    server {
        listen   443 ssl;
server_name  域名/IP;
#ssl on; # 开启ssl证书访问
ssl_certificate  ./1_bundle.crt;
ssl_certificate_key  ./2_*.key;
ssl_session_timeout  60m; # session有效时间10分钟
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; # 按照这个套件配置
ssl_prefer_server_ciphers on;                                                                                                         
        location / {
           proxy_pass http://ip:80;
           proxy_set_header Host $proxy_host;	#获取正确的IP和端口号
           proxy_set_header X-Real-IP $remote_addr;	#获取正确请求的远程IP
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;	#获取正确的ip
      client_max_body_size 100M;
        }
        #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;
        }
    }


}

 

更新配置后,重启nginx,最后通过https://域名:9001即可访问到图片了.

 

--------------------------------------------

 

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

 

问题原因
按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
————————————————
版权声明:本文为CSDN博主「SummerGao.」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_25231683/article/details/128734555

posted @ 2023-07-24 18:25  技术颜良  阅读(1785)  评论(0编辑  收藏  举报