nginx二级目录代理minio指定桶
nginx提供了外网地址,通过二级目录可以代理内网minio的具体桶,将图片展示。
配置如下:
server {
listen 8443 ssl;
server_name yourdomain.com;
ssl_certificate /path/to/your/certificate.crt;
ssl_certificate_key /path/to/your/private.key;
location /hncs-zhujian/ {
proxy_pass http://minio_ip:9000/hncs-zhujian/;
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-Proto $scheme;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
}
}
访问方式:
minio的图片地址是:http://minio_ip:9000/hncs-zhujian/static/house_default_1729816061370.jpg
那么代理后的访问方式:
https://yourdomain.com:8443/hncs-zhujian/static/house_default_1729816061370.jpg