Report this

What is the reason for this report?

NodeJS app is not accessible on ip/domain.

Posted on October 1, 2023

I have a Node.js application that is running and accessible from other VPS. However, I am unable to run the application on DigitalOcean.The code is the same and I am using the same method to install. though npm and node versions are also the same. The applications were installed successfully in the Digitalocean droplet but isn’t accessible on IP. I have tried both new droplets and NodeJS app. On the new droplet the ip simply shows “refused to connect” and on nodejs it shows “502 bad gateway”. p.s NodeJS app is running and online but still isn’t accessible via ip/domain



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.

Heya @floatingbluegreenseal,

It seems you are using Nginx as a reverse proxy, is that correct? Can you share your nginx configuration that is related to your App?

Additionally, have you allowed the IPs to be accessible through your firewall? Can you type in

ufw status

And let me know the output.

Hi there,

This sounds like an issue with your Nginx configuration. As you’re using a proxy like Nginx and encountering a “502 Bad Gateway” error, I could suggest the following:

  • Check the error logs for Nginx using sudo tail -n 50 /var/log/nginx/error.log. This should provide more detailed information about the 502 error.
  • Ensure your proxy is correctly set up to forward requests to the correct port and address where your Node.js app is running.

If the port in the Nginx configuration does not match the port that your Node.js service is running on you would get the 502 error.

You could use the netstat -plant command to check what port your app is listening on.

Let me know how it goes!

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.