server { listen 7860; server_name localhost; # Forward requests starting with /api/ to the Python service (port 7860) location / { proxy_pass http://localhost:7861/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } # All other requests go to the Next.js app (port 3000) location /nextjs/ { rewrite ^/nextjs/(.*)$ /$1 break; proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }