45 lines
1.2 KiB
Nginx Configuration File
45 lines
1.2 KiB
Nginx Configuration File
|
|
# Configuración de nginx para el contenedor frontend
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name localhost;
|
||
|
|
root /usr/share/nginx/html;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
# Logs
|
||
|
|
access_log /var/log/nginx/access.log;
|
||
|
|
error_log /var/log/nginx/error.log;
|
||
|
|
|
||
|
|
# Gzip compression
|
||
|
|
gzip on;
|
||
|
|
gzip_vary on;
|
||
|
|
gzip_min_length 1000;
|
||
|
|
gzip_types text/plain text/css text/xml text/javascript
|
||
|
|
application/json application/javascript application/xml+rss
|
||
|
|
application/x-javascript application/xhtml+xml;
|
||
|
|
|
||
|
|
# SPA fallback - todas las rutas devuelven index.html
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Cache para assets estáticos con hash
|
||
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||
|
|
expires 1y;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
try_files $uri =404;
|
||
|
|
}
|
||
|
|
|
||
|
|
# No cachear index.html
|
||
|
|
location = /index.html {
|
||
|
|
expires -1;
|
||
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||
|
|
}
|
||
|
|
|
||
|
|
# Denegar acceso a archivos ocultos
|
||
|
|
location ~ /\. {
|
||
|
|
deny all;
|
||
|
|
access_log off;
|
||
|
|
log_not_found off;
|
||
|
|
}
|
||
|
|
}
|