By vikramkh
I span up a Node.js Droplet, cloned my git repo, and did an npm install then an npm start. I got the message:
http://[::1]:3000http://[::1]:3000/pingIf I ping the droplet IP address (ping <dropletIPAddress>) from the terminal, I get a response, but if I try to go to the <dropletIpAddress>:3000, I get “This site can’t be reached”.
What could be wrong?
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!
Hi there,
What I would personally suggest is using Nginx as a reverse proxy so that you could also issue an SSL certificate, you can follow the steps on how to do that here:
Here is also a YouTube video on how to do the same:
Regarding your specific issue itself, this issue might be due to a few reasons. Here are some steps you can take to resolve the issue:
Listen on the correct IP address: In some cases, applications listen on localhost (127.0.0.1 or [::1]) by default and do not accept connections from other IP addresses. To solve this, in your application, when starting the server, instead of .listen(3000), use .listen(3000, '0.0.0.0'). This tells your application to listen on all available network interfaces.
Firewall: Your firewall may be blocking incoming connections to port 3000. If you’re on a Linux server, you can use iptables or ufw to allow incoming connections. With ufw, the command would be sudo ufw allow 3000. If you’re using DigitalOcean’s firewall service, you’ll need to add a rule to allow incoming traffic on port 3000.
Ensure your application is running: Make sure that your application is still running. Node.js applications will stop if there’s an uncaught exception, or if they are manually stopped. You can use tools like pm2, forever or nodemon to make sure your application restarts if it crashes.
Check server logs: If none of the above works, you should check the logs for your application and your server. They may provide more information on why connections are failing.
Check if the Node.js application is successfully starting: If there’s a problem with the application code, the Node.js process may be crashing on startup. Use npm start and check the console for any error messages.
Remember to replace 3000 with the actual port your Node.js application is running on if it’s different.
Best,
Bobby
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.