35 lines
1.2 KiB
Nginx Configuration File
35 lines
1.2 KiB
Nginx Configuration File
# CTAO portal demo — static serving. The cache split is what makes the
|
|
# 10-second publish loop feel instant: HTML is revalidated on every request
|
|
# (a symlink flip shows up on the next refresh), fingerprinted assets are
|
|
# cached forever.
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /srv/releases/current;
|
|
charset utf-8;
|
|
error_page 404 /404.html; # Astro emits 404.html at the site root
|
|
# Directory redirects (/admin -> /admin/) must stay relative: an absolute
|
|
# redirect is built from listen port 80 and loses the real port whenever the
|
|
# site is reached through a tunnel or a proxy on a non-default port.
|
|
absolute_redirect off;
|
|
|
|
# Fingerprinted build assets (/_astro/<name>.<hash>.*) — immutable
|
|
location /_astro/ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
# Editor-uploaded media (stable paths, may be re-uploaded) — short cache
|
|
location /uploads/ {
|
|
add_header Cache-Control "public, max-age=3600";
|
|
}
|
|
|
|
# Everything else: HTML pages, feeds, /admin (Sveltia is static files too)
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript application/json image/svg+xml application/rss+xml text/xml;
|
|
}
|