1 | server { |
2 | listen 443 ssl http2; |
3 | listen [::]:443 ssl http2; |
4 | server_name joshstock.in; |
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 |
|
18 | location ~* ^\/u(\/.+)$ { |
19 | root /var/www/yourls; |
20 | try_files $1 $1/ /u/yourls-loader.php; |
21 |
|
22 | location ~* ^\/u(\/.+\.php)$ { |
23 | root /var/www/yourls; |
24 |
|
25 | fastcgi_index index.php; |
26 |
|
27 | try_files $1 $1/ =404; |
28 |
|
29 | fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; |
30 | fastcgi_param SCRIPT_FILENAME $document_root$1; |
31 | fastcgi_split_path_info (.+\.php)(/.+)$; |
32 |
|
33 | set $path_info $fastcgi_path_info; |
34 | fastcgi_param PATH_INFO $path_info; |
35 |
|
36 | include fastcgi_params; |
37 | } |
38 | } |
39 | location = /resume { |
40 | rewrite /resume /static/resume.pdf; |
41 | } |
42 | location = /josh.gpg { |
43 | rewrite /josh.gpg /static/josh.gpg; |
44 | } |
45 | location ~ /static/(.*) { |
46 | try_files $uri $uri.html @s3static; |
47 | } |
48 | set $bucket "joshstockin.s3.us-east-2.amazonaws.com"; |
49 | location @s3static { |
50 | proxy_intercept_errors on; |
51 | proxy_redirect off; |
52 | add_header Cache-Control max-age=31536000; |
53 | proxy_pass https://$bucket/$1; |
54 | } |
55 | } |
56 |
|