使用轻量应用服务器反向代理对象存储
最近阿里和腾讯都出了峰值 200 Mbps 的轻量应用服务器,这么大的带宽,很适合用来取代 CDN 降低成本。
对象存储权限设置
对于私有储存,可以设置授权策略,让轻量应用服务器无需鉴权即可访问对象存储。
界面:储存桶 -> 权限控制 -> Bucket 授权策略
- 授权用户:所有账号
- 授权操作:简单设置-只读
- 条件:IP=
轻量应用服务器内网 IP
Nginx 配置
location ^~ / {
# 替换成自己的 Bucket 域名(内网)
proxy_pass http://demo.oss-cn-shenzhen-internal.aliyuncs.com;
# 替换成自己的 Bucket 域名(内网)
proxy_set_header Host demo.oss-cn-shenzhen-internal.aliyuncs.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
}