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 /static/error/404.html; location = /static/error/404.html {} location = / { index index.html; } location = /favicon.ico { try_files /static/favicon.ico =404; } location / { try_files $uri $uri.xml $uri.html /static/$uri =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 = /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; } }