Question
Making a droplet's nodejs accessible - along with apache
Hi,
I have just installed nodejs, and I have a script running that is listening on port 1337
ie.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337);
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
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.
×
As long as Apache and the node app are listening on separate ports, there shouldn’t be any problems running them together. On the server, what’s the output of
netstat -plunt
?