server { listen 80; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } # Proxy API requests to backend location /api/ { # 'backend' is the service name in docker-compose # We strip the /api/ prefix if the backend doesn't expect it, # but in this setup the backend routes are /history, /tracks etc. # It's cleaner to keep /api prefix in frontend and rewrite here or configure backend to serve on /api # For simplicity, let's proxy /api/ to / rewrite ^/api/(.*) /$1 break; proxy_pass http://backend:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }