nginx 反向代理 oss

场景: 动态配置静态化为文件

(1) 前端展示是根据后台的配置动态展示;

(2) 配置的内容,短时间不变,但是每次都得从服务端获取;

方式:

(1) 将配置静态化为json文件,防止在oss或者cdn磁盘文件;

(2) 若是oss, 且域名不方便绑定的情况(多用户平台,客户域名不一样), 可以使用nginx反向代理;

(3) nginx配置举例子:

upstream txyunoss {

server myoss.oss-cn-beijing-internal.txyunoss.com;

}

location /mysaas/fileconf {

proxy_pass http://txyunoss;

#Proxy Settings

#proxy_redirect off;

proxy_set_header Host myoss.oss-cn-beijing-internal.txyunoss.com;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

proxy_max_temp_file_size 0;

proxy_connect_timeout 90;

proxy_send_timeout 90;

proxy_read_timeout 90;

proxy_buffer_size 4k;

proxy_buffers 4 32k;

proxy_busy_buffers_size 64k;

}

nginx 反向代理 oss

相关推荐