What else is required to access node app outside of the DigitalOcean droplet?

Originally posted on SO

We have set up a node server which runs on PORT 5000.

In a newly created droplet, we have installed and started nginx. To access the node app, we have changed the default port from 80 to 5000 in /etc/nginx/sites-enabled/default

server {
        listen 5000 default_server;
        listen [::]:5000 default_server;

ufw is enabled

sudo ufw enable

Also the port is enabled

sudo ufw allow 5000/tcp

Also, tried this way too:

sudo ufw allow 5000

As confirmed with sudo ufw status

sudo ufw status

Also the app is configured to listen on the public interface

const server = app.listen(process.env.PORT || 5000, '', () => {
    console.log('Express server listening on port %d in %s mode', server.address().port, app.settings.env);

However, not even the default PORT was responding. HENCE, reverted to 80 as the default PORT.

What else is required to access node app outside of the droplet?

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

First of all, you can’t have Nginx and Node.js listen on the same port, which is in your case :5000. You can have only one app listening on the same port at the time.

Second, if you want to use with Nginx, you have to setup Proxy Pass as described in the How To Set Up a Node.js Application for Production on Ubuntu 16.04 tutorial.

Then, you should be able to use Node.js + Nginx if you want to do so.