How do I add a new backend instance for load balancing?
Add a new line to the upstream block: server 127.0.0.1:3001. Start the Node.js instance on that port. Test with nginx -t and reload. Nginx automatically distributes traffic to the new instance. Use 'down' to temporarily remove an instance with zero downtime.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Nginx Config Update Checklist and Summary Complete Guide for Node.js
Always: back up the current config, edit the config, test with nginx -t, reload with systemctl reload nginx (zero downtime), verify with systemctl status and curl, and rollback if needed. Never skip the test step a syntax error could take down your entire app.
Initial: server block and proxy_pass. SSL: certbot --nginx. WebSocket: /socket.io/ block with Upgrade headers. Frontend: static files with try_files. Performance: gzip, caching, workers. Security: headers, rate limiting. Load balancing: upstream with ip_hash.
Add a new server block with server_name new.yourdomain.com and the appropriate location/proxy_pass. Get SSL with sudo certbot --nginx -d new.yourdomain.com. Test with nginx -t and reload. Ensure DNS A record for the subdomain points to your server.
Still have questions?
Browse all our FAQs or reach out to our support team
