# EMOJESIS — nginx vhost for emojesis.pablomurad.com # Static HTML/CSS/JS. Service worker needs sw.js without long cache. # # Panel placeholders: {{root}}, {{ssl_certificate}}, {{settings}}, etc. # Set {{root}} to the directory containing index.html (e.g. /home/.../emojesis/public) server { listen 80; listen [::]:80; listen 443 quic; listen 443 ssl; listen [::]:443 quic; listen [::]:443 ssl; http2 on; http3 off; {{ssl_certificate_key}} {{ssl_certificate}} server_name emojesis.pablomurad.com; {{root}} {{nginx_access_log}} {{nginx_error_log}} if ($scheme != "https") { rewrite ^ https://$host$request_uri permanent; } location ~ /.well-known { auth_basic off; allow all; } {{settings}} include /etc/nginx/global_settings; index index.html; # Service worker — must revalidate or updates never reach clients location = /sw.js { add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Service-Worker-Allowed "/"; try_files $uri =404; } # Shell — avoid aggressive cache on the entry document location = /index.html { add_header Cache-Control "no-cache, must-revalidate"; try_files $uri =404; } # Versioned-ish assets (bump sw.js CACHE in app releases) location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|xml|md)$ { add_header Access-Control-Allow-Origin "*"; add_header alt-svc 'h3=":443"; ma=86400'; expires 7d; access_log off; try_files $uri =404; } # Everything else: file if present, else index.html (single-page game) location / { try_files $uri $uri/ /index.html; } if (-f $request_filename) { break; } }