server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Compress text assets. gzip on; gzip_types text/plain text/css application/javascript application/json image/svg+xml; gzip_min_length 1024; # Proxy API calls to the API Server. The /api prefix is preserved because # ${API_TARGET} has no path, so /api/me -> $API_TARGET/api/me. location /api/ { proxy_pass ${API_TARGET}; 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; } # Cache fingerprinted build assets aggressively. location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # SPA fallback: unknown routes return index.html so the Vue router handles them. location / { try_files $uri $uri/ /index.html; } }