server { listen 8340; server_name _; root /app/web; index index.html; # API reverse proxy to backend location /api/ { proxy_pass http://127.0.0.1:8341/api/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Connection ""; proxy_buffering off; proxy_cache off; proxy_read_timeout 3600s; } # SPA fallback location / { try_files $uri $uri/ /index.html; } # Static assets cache location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { expires 30d; add_header Cache-Control "public, immutable"; } }