From a33d8d8e633a8682c1d8bd52d652fb3270999f00 Mon Sep 17 00:00:00 2001 From: Carmine Savino Date: Wed, 28 Jan 2026 17:56:03 +0100 Subject: [PATCH] Aggiorna la configurazione di Nginx per supportare Vue.js e migliora la gestione degli errori --- nginx.conf | 58 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/nginx.conf b/nginx.conf index 25f1865..a72f503 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,30 +1,30 @@ -server { - listen 80; - server_name localhost; - root /usr/share/nginx/html; - index index.html; - - # Gzip compression - gzip on; - gzip_vary on; - gzip_min_length 10240; - gzip_proxied expired no-cache no-store private auth; - gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/javascript application/json; - gzip_disable "MSIE [1-6]\."; - - # Gestione delle rotte per SPA - location / { - try_files $uri $uri/ /index.html; - } - - # Cache per asset statici - location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|svg|woff|woff2|ttf|eot)$ { - expires 1y; - add_header Cache-Control "public, immutable"; - } - - # Security headers - add_header X-Frame-Options "SAMEORIGIN" always; - add_header X-Content-Type-Options "nosniff" always; - add_header X-XSS-Protection "1; mode=block" always; +user nginx; +worker_processes 1; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +events { + worker_connections 1024; } +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + server { + listen 80; + server_name localhost; + location / { + root /app; + index index.html; + try_files $uri $uri/ /index.html; # <--- LA MAGIA PER VUE.JS + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } +} \ No newline at end of file