nginx二級目錄代理minio指定桶

邹姣姣發表於2024-11-08

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

相關文章