char-slop/chordpad.vibed.software
git clone https://git.t4t.associates/char-slop/chordpad.vibed.software
3c7bc6e
main
1import ngx from "jsr:@char/ngx@0.2.2" ; 2 3const DOMAIN = "chordpad.vibed.software" 4const ROOT = "/srv/www/chordpad.vibed.software/dist" 5 6export const config = ngx ( undefined , [ 7ngx ( "server" , [ 8[ ngx . serverName ( DOMAIN ), "listen 80" , "listen [::]:80" ], 9[ `return 301 https://$host$request_uri` ], 10]), 11 12ngx ( "server" , [ 13[ ngx . serverName ( DOMAIN ), ...ngx . listen (), ...ngx . letsEncrypt ( DOMAIN )], 14[ `root ${ ROOT } ` , "index index.html" ], 15[ "gzip on" , "gzip_types text/css application/javascript image/svg+xml" ], 16 17// vite names these by their contents, so a name never means anything else 18ngx ( "location /assets/" , [ 19'add_header Cache-Control "public, max-age=31536000, immutable"' , 20"try_files $uri =404" , 21]), 22// but the page always gets checked, so it doesn't point at a previous build's assets 23ngx ( "location = /index.html" , [ 'add_header Cache-Control "no-cache"' ]), 24ngx ( "location /" , [ "try_files $uri /index.html" ]), 25 26// TheoryTab pages can't be read cross-origin, so imports fetch them through here (vite's dev 27// server does the same). only song pages, and only reading them 28ngx ( "location /hooktheory/theorytab/view/" , [ 29ngx ( "limit_except GET" , [ "deny all" ]), 30[ 31"proxy_pass https://www.hooktheory.com/theorytab/view/" , 32"proxy_set_header Host www.hooktheory.com" , 33// hooktheory sits behind cloudflare, which needs the name to pick a certificate 34"proxy_ssl_server_name on" , 35'proxy_set_header Cookie ""' , 36], 37]), 38]), 39]); 40 41if ( import . meta. main ) { 42console . log ( config . build ()); 43}