Files
website/nginx.conf

51 lines
1.3 KiB
Nginx Configuration File
Raw Normal View History

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
index index.html;
charset utf-8;
server_tokens off;
etag on;
gzip on;
gzip_vary on;
gzip_min_length 512;
gzip_comp_level 6;
gzip_types
application/javascript
application/json
application/xml
image/svg+xml
text/css
text/plain
text/xml;
location ~* \.[0-9a-f]{32,}\.(?:css|js)$ {
try_files $uri =404;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
location ~* \.(?:avif|gif|ico|jpe?g|png|svg|webp|woff2?|ttf)$ {
try_files $uri =404;
add_header Cache-Control "public, max-age=2592000, stale-while-revalidate=86400" always;
}
location ~* \.(?:xml|txt)$ {
try_files $uri =404;
add_header Cache-Control "public, max-age=3600, stale-while-revalidate=86400" always;
}
location / {
try_files $uri $uri/ =404;
add_header Cache-Control "public, max-age=0, s-maxage=3600, stale-while-revalidate=86400" always;
}
error_page 404 /404.html;
location = /404.html {
internal;
add_header Cache-Control "no-cache" always;
}
}