deploy/emojesis.pablomurad.com.conf (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# 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;
}
}
|