I created a simple nodejs app on the Digital Ocean server following the instructions from Digital Ocean. The code is
#!/usr/bin/env nodejs
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8080, '138.68.244.XXX'); //138.68.244.XXX is the IP of my Digital Ocean server
console.log('Server running at http://localhost:8080/');
After I started the app by the command “node hello.js” I got output --> “Server running at http://localhost:8080/”
I was able to curl the URL->curl http://138.68.244.XXX:8080 to get “Hello World” on the server itself. However, when I tried http://138.68.244.XXX:8080 on a browser, I got “ERR_CONNECTION_TIMED_OUT” error.
Please help.
Thank you!
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!
If the app is accessible locally on the server itself but not on the Internet, the first thing I would check is if a firewall is blocking port 8080. If you are using the DigitalOcean One-Click app, the “ufw” firewall is enabled, and all ports except for 22, 80, and 443 are blocked by default.
To open port 8080, run:
- sudo ufw allow 8080
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.