Aggiorna la configurazione di Nginx per supportare Vue.js e migliora la gestione degli errori
All checks were successful
GKE Deploy / build-and-deploy (push) Successful in 22s

This commit is contained in:
2026-01-28 17:56:03 +01:00
parent 6852128ef8
commit a33d8d8e63

View File

@@ -1,30 +1,30 @@
server { user nginx;
listen 80; worker_processes 1;
server_name localhost; error_log /var/log/nginx/error.log warn;
root /usr/share/nginx/html; pid /var/run/nginx.pid;
index index.html; events {
worker_connections 1024;
# Gzip compression }
gzip on; http {
gzip_vary on; include /etc/nginx/mime.types;
gzip_min_length 10240; default_type application/octet-stream;
gzip_proxied expired no-cache no-store private auth; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/javascript application/json; '$status $body_bytes_sent "$http_referer" '
gzip_disable "MSIE [1-6]\."; '"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
# Gestione delle rotte per SPA sendfile on;
location / { keepalive_timeout 65;
try_files $uri $uri/ /index.html; server {
} listen 80;
server_name localhost;
# Cache per asset statici location / {
location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|svg|woff|woff2|ttf|eot)$ { root /app;
expires 1y; index index.html;
add_header Cache-Control "public, immutable"; try_files $uri $uri/ /index.html; # <--- LA MAGIA PER VUE.JS
} }
error_page 500 502 503 504 /50x.html;
# Security headers location = /50x.html {
add_header X-Frame-Options "SAMEORIGIN" always; root /usr/share/nginx/html;
add_header X-Content-Type-Options "nosniff" always; }
add_header X-XSS-Protection "1; mode=block" always; }
} }