server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name joshstock.in; rewrite ^/(.*)/$ /$1 permanent; # truncate forward slash root /var/www/html; 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 "joshstockin.s3.us-east-2.amazonaws.com"; location @s3static { proxy_intercept_errors on; proxy_redirect off; add_header Cache-Control max-age=31536000; proxy_pass https://$bucket/$1; } }