minio将http改为https方式访问

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

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

尝试使用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即可访问到图片了.

上一篇:docker-compose安装Minio


下一篇:文件服务器minio