Hi everyone,
I’m currently working on deploying my app on Ubuntu 20.04. I’m using a stack that includes Nginx, Node.js, and MongoDB, and I’m deploying via DigitalOcean Droplet.
Here’s the issue I’m facing on my website
I’ve reviewed the documentation for Nginx and other relevant software, but I’m still stuck.
Could anyone guide me on troubleshooting this or suggest useful resources? Any advice would be greatly appreciated!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey there! 👋
I’ve answered a similar question in the past here:
A 502 Bad Gateway error usually means that Nginx is unable to connect to your backend server (in this case, Node.js). Here’s a checklist to help you troubleshoot and get things running smoothly!
1. Confirm Node.js Server Is Running and Accessible
<PORT_NUMBER>
with the port your Node app is supposed to be listening on (e.g., 3000).2. Verify Nginx Configuration
/etc/nginx/sites-available/default
or/etc/nginx/sites-enabled/default
, and ensure it’s set up to proxy requests to the correct port where Node.js is running.<PORT_NUMBER>
with the port your Node.js app is using.3. Check Nginx Logs
4. Restart Services
On another note, if you’re handling a production environment, you might want to consider using DigitalOcean Managed Databases for MongoDB. Managed Databases handle backups, scaling, and recovery, which can make your life easier.
Let me know if any of this helps!
- Bobby