cuteftp 2018-3-19 09:04
使用 Nginx reverse proxy 反向代理 AWS S3 resources
需求:<br>1.實現代理s3的nginx緩存服務器<br>2.實現nginx代理服務器的 / 路徑到s3的指定目錄映射,即 / -> bucket-name.s3-website-ap-northeast-1.amazonaws.com/<br><br>最重要的就是在 server { } 中加上底下這段:<br>[quote]<br> location / {<br> proxy_http_version 1.1;<br> proxy_set_header Connection "";<br> proxy_set_header Authorization '';<br> proxy_set_header Host bucket-name.s3-website-ap-northeast-1.amazonaws.com;<br> proxy_hide_header x-amz-id-2;<br> proxy_hide_header x-amz-request-id;<br> proxy_hide_header x-amz-meta-server-side-encryption;<br> proxy_hide_header x-amz-server-side-encryption;<br> proxy_hide_header Set-Cookie;<br> proxy_ignore_headers Set-Cookie;<br> proxy_intercept_errors on;<br> add_header Cache-Control max-age=31536000;<br> proxy_pass http://bucket-name.s3-website-ap-northeast-1.amazonaws.com/;<br> }<br>[/quote]<br><br>這樣就可以囉~<br><br>參考資料:<br>https://stackoverflow.com/questions/44639182/nginx-proxy-amazon-s3-resources/44749584#44749584<br>