By xameeramir
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;
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
Also the app is configured to listen on the public interface
const server = app.listen(process.env.PORT || 5000, '0.0.0.0', () => {
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?
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!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.