Papure/docker/nginx.conf
agent 23d0c29e0b Add Dockerfile and compose setup for self-hosting
Multi-stage build: Node builds the static PWA, nginx serves it with an SPA
fallback, long-lived caching for hashed assets, no-cache for the app shell
and service worker, and the correct type for the web manifest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VsorPV3JeJRoZ1mD1pdvtL
2026-09-26 22:33:08 +00:00

33 lines
867 B
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
gzip on;
gzip_types text/css application/javascript application/json application/manifest+json image/svg+xml;
# Hashed build output never changes.
location /_app/immutable/ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# The service worker and app shell must be re-checked so updates reach clients.
location = /service-worker.js {
add_header Cache-Control "no-cache";
try_files $uri =404;
}
# nginx's default MIME table has no entry for the PWA manifest.
location ~ \.webmanifest$ {
types { }
default_type application/manifest+json;
add_header Cache-Control "no-cache";
}
# Client-side app: unknown paths fall back to the SPA shell.
location / {
add_header Cache-Control "no-cache";
try_files $uri $uri/ /index.html;
}
}