mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-04-03 22:44:49 -04:00
55 lines
1.7 KiB
Nginx Configuration File
55 lines
1.7 KiB
Nginx Configuration File
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Add MIME type mapping for JavaScript modules
|
|
types {
|
|
application/javascript mjs;
|
|
}
|
|
|
|
# Gzip Settings
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_buffers 16 8k;
|
|
gzip_http_version 1.1;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
server {
|
|
listen 3000;
|
|
server_name localhost;
|
|
|
|
# Never cache index.html and appsettings.json
|
|
# index.html contains the import map with fingerprinted asset references
|
|
# and must always be fresh to ensure users get the latest version
|
|
location ~* ^/(index\.html|appsettings\.json)$ {
|
|
root /usr/share/nginx/html;
|
|
expires -1;
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
|
add_header Pragma "no-cache";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Cache all static assets aggressively (1 year)
|
|
# .NET 10 fingerprinting ensures unique filenames for _framework files
|
|
# so they can be safely cached - stale files won't be requested
|
|
location ~* \.(css|js|mjs|woff|woff2|ttf|eot|png|jpg|jpeg|gif|ico|svg|webp|wasm|dll|dat)$ {
|
|
root /usr/share/nginx/html;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Default location for all other files
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
try_files $uri $uri/ /index.html =404;
|
|
}
|
|
}
|
|
}
|