Files

58 lines
1.4 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
absolute_redirect off;
port_in_redirect off;
root /usr/share/nginx/html;
index index.html;
include /etc/nginx/mime.types;
types {
application/manifest+json webmanifest;
}
location = / {
return 301 /tracking/mila/;
}
location = /tracking/mila {
return 301 /tracking/mila/;
}
location /tracking/mila/ {
try_files $uri $uri/ /tracking/mila/index.html /index.html;
}
location / {
try_files $uri $uri/ /index.html;
}
# Service worker
location ~* /sw\.js$ {
default_type application/javascript;
expires -1;
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
add_header Service-Worker-Allowed "/tracking/mila/";
}
# Webmanifest and manifest.json
location ~* /(?:mila\.webmanifest|manifest\.webmanifest|manifest\.json)$ {
default_type application/manifest+json;
expires -1;
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
}
# Static assets cache
location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|svg|woff|woff2|ttf)$ {
expires 1y;
add_header Cache-Control "public";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}