server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name joshstock.in; rewrite ^/(.*)/$ /$1 permanent; # truncate forward slash root /var/www/josh; error_page 404 /error-404.html; location = /error-404.html {} location = / { index index.html; } location / { try_files $uri $uri.html =404; } location ~* ^\/u(\/.+)$ { root /var/www/yourls; try_files $1 $1/ /u/yourls-loader.php; location ~* ^\/u(\/.+\.php)$ { root /var/www/yourls; fastcgi_index index.php; try_files $1 $1/ =404; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$1; fastcgi_split_path_info (.+\.php)(/.+)$; set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; include fastcgi_params; } } 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; } }