server { listen 80; root /usr/share/nginx/html; index index.html; # SPA routing — all non-asset paths → index.html location / { try_files $uri $uri/ /index.html; } # Proxy API requests to FastAPI (host network, port 8522) location /api/ { proxy_pass http://host.docker.internal:8522; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }