Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (39 sloc) 1.42 KB
# https://stackoverflow.com/questions/44639182/nginx-proxy-amazon-s3-resources/44749584#44749584
# https://github.com/PressLabs/gs-proxy/blob/master/nginx.conf
proxy_cache_path /tmp/ levels=1:2 keys_zone=gcs_cache:10m max_size=500m inactive=60m use_temp_path=off;
server {
listen 8000;
server_name www.zihao.me;
return 301 https://zihao.me$request_uri;
}
server {
listen 8000 default_server;
server_name zihao.me;
charset utf-8;
sendfile on;
gzip on;
# Logs
# access_log off;
# error_log /tmp/zihao.me.error.log;
access_log /dev/stdout;
error_log /dev/stdout;
# Nameserver
resolver 8.8.8.8 valid=300s;
resolver_timeout 10s;
recursive_error_pages on;
location / {
include /etc/nginx/nginx_gcs_proxy.conf;
proxy_pass https://storage.googleapis.com/storage.zihao.me/zihao.me$uri;
error_page 404 = @index;
}
location @index {
include /etc/nginx/nginx_gcs_proxy.conf;
proxy_pass https://storage.googleapis.com/storage.zihao.me/zihao.me${uri}index.html;
error_page 404 = @slash_index;
}
location @slash_index {
include /etc/nginx/nginx_gcs_proxy.conf;
proxy_pass https://storage.googleapis.com/storage.zihao.me/zihao.me${uri}/index.html;
error_page 404 = /404.html;
}
}