Making a droplet's nodejs accessible - along with apache


I have just installed nodejs, and I have a script running that is listening on port 1337


var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
console.log('Server running at 1337/');

I have run:

iptables -F 
iptables -A INPUT -p tcp -m tcp --dport 1337 -j ACCEPT

I did - and stiil do have apache running. And there is an SSL certificate operating on the Ubuntu server.

https://xxx:1337 (where xxx is known by the SSL cert) says ‘This webpage is not available’.

Of course, https://xxx brings up the page via apache.

Can I access nodejs while apache is running? What am I missing here?

Colin G

Show comments

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.

Here is the nmap output:

Starting Nmap 5.21 ( ) at 2014-10-25 11:57 UTC Found no matches for the service mask ‘lunt’ and your specified protocols QUITTING!

https://xxx:1337 (where xxx is known by the SSL cert) says ‘This webpage is not available’.

You are accessing port 1337 on your server, which goes directly to your nodejs app. Your app isn’t configured to use SSL, so you’ll get an error when you try to access it via https://.

In this case I would recommend using Apache as a reverse proxy to your nodejs app which will also serve as an SSL termination proxy so your app wouldn’t have to know anything about SSL – it would just work.

See How To Use Apache HTTP Server As Reverse-Proxy Using mod_proxy Extension | DigitalOcean.