有时候使用了阿里云OSS,但是想用ECS反代来提供服务
配置如下;
OSS需要配置权限允许ecs的ip访问;注意:如果使用bucket权限需要配置ecs的内网ip。
server {
listen 80;
listen [::]:80;
server_name xx.xx.com;
root /var/www/xx;
index index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.html;
}
location /images/ {
proxy_pass http://fc-console-gen-cn-shanghai-123.oss-cn-shanghai-internal.aliyuncs.com/;
proxy_hide_header Content-Disposition;
proxy_hide_header x-oss-request-id;
proxy_hide_header x-oss-object-type;
proxy_hide_header x-oss-hash-crc64ecma;
proxy_hide_header x-oss-storage-class;
proxy_hide_header x-oss-force-download;
proxy_hide_header x-oss-server-time;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /var/log/nginx/xx.xx.com.log;
}
赞助一杯咖啡☕️
本文由 widdy 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Jul 23, 2020 at 05:08 pm