38 lines
965 B
Nginx Configuration File
38 lines
965 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Compresion
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript
|
|
text/xml application/xml application/xml+rss text/javascript
|
|
image/svg+xml;
|
|
gzip_min_length 1024;
|
|
|
|
# Cache larga para los assets con hash en el nombre
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# SPA: cualquier ruta desconocida devuelve index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# index.html nunca se cachea, para que los deploys se vean al instante
|
|
location = /index.html {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
internal;
|
|
}
|
|
}
|