| 1 | server { |
| 2 | listen 80; |
| 3 | listen [::]:80; |
| 4 | server_name localhost; |
| 5 | rewrite ^/(.*)/$ /$1 permanent; # truncate forward slash |
| 6 | root /var/www/html; |
| 7 | error_page 404 /error-404.html; location = /error-404.html {} |
| 8 | location = / { |
| 9 | index index.html; |
| 10 | } |
| 11 | location / { |
| 12 | try_files $uri $uri.html =404; |
| 13 | } |
| 14 | location ~* ^\/blog\/(.*)$ { |
| 15 | try_files /blog-$1.html =404; |
| 16 | } |
| 17 | location = /resume { |
| 18 | rewrite /resume /static/resume.pdf; |
| 19 | } |
| 20 | location ~ /static/(.*) { |
| 21 | try_files $uri $uri.html @s3static; |
| 22 | } |
| 23 | set $bucket "joshstock.in/static"; |
| 24 | location @s3static { |
| 25 | proxy_intercept_errors on; |
| 26 | proxy_redirect off; |
| 27 | add_header Cache-Control max-age=31536000; |
| 28 | proxy_pass https://$bucket/$1; |
| 29 | } |
| 30 | } |
| 31 |
|