You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1016 B
Nginx Configuration File
37 lines
1016 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Compressão para texto/JS/CSS.
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_proxied any;
|
|
gzip_types text/plain text/css application/javascript application/json
|
|
image/svg+xml application/xml application/xml+rss;
|
|
|
|
# Assets com hash (Vite -> /assets/*.[hash].*): cache longo e imutável.
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# SPA fallback: qualquer rota/refresh devolve index.html.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# index.html nunca em cache (garante deploy fresco).
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
}
|
|
|
|
# Páginas de erro também caem no SPA.
|
|
error_page 404 /index.html;
|
|
}
|