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