server { listen 80; listen [::]:80; server_name ~.; rewrite ^/(.*)/$ /$1 permanent; # truncate forward slash root /var/www/josh; error_page 404 /error-404.html; location = /error-404.html {} location = / { index index.html; } location / { try_files $uri $uri.html =404; } location ~* ^\/blog\/(.*)$ { try_files /blog-$1.html =404; } location = /resume { rewrite /resume /static/resume.pdf; } location ~ /static/(.*) { try_files $uri $uri.html @s3static; } set $bucket "joshstock.in/static"; location @s3static { proxy_intercept_errors on; proxy_redirect off; add_header Cache-Control max-age=31536000; proxy_pass https://$bucket/$1; } }