Files
umlaut-press/nginx/conf.d/default.conf
2026-02-12 23:41:57 -03:00

52 lines
1.4 KiB
Plaintext

server {
listen 80;
listen [::]:80;
server_name localhost;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# HTML: revalidate so content updates are seen quickly
location ~* \.html?$ {
add_header Cache-Control "public, no-cache";
try_files $uri $uri/ =404;
}
# Versioned/hashed assets: long cache, immutable
location ~* \.(js|css)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# Images and media
location ~* \.(ico|png|jpg|jpeg|gif|webp|svg|avif)$ {
expires 30d;
add_header Cache-Control "public";
try_files $uri =404;
}
# Fonts
location ~* \.(woff2?|ttf|otf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# PHP (e.g. site_archive)
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Default: serve static files, then try directory/index, then 404
location / {
add_header Cache-Control "public, no-cache";
try_files $uri $uri/ /index.html =404;
}
}