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