I am running a Debian instance on Amazon EC2 with Node.js installed. If I run the code below:
http = require('http'); http.createServer(function (request, response){ response.writeHead(200, {'Content-Type':'text/plain'}); response.end('Hello World\n'); }).listen(80); console.log("Running server at port 80");
I get the output below that tells me that another process is listening on port 80:
Running server at port 80 events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EACCES at errnoException (net.js:901:11) at Server._listen2 (net.js:1020:19) at listen (net.js:1061:10) at Server.listen (net.js:1127:5) at Object.<anonymous> (/home/admin/nodetests/nodetest.js:6:4) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10)
Now, when I check if there is a process (as root, if something is hidden), listening on port 80 with:
netstat -tupln
I get the bottom output which tells me that it is not listening on port 80:
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1667/sshd tcp6 0 0 :::22 :::* LISTEN 1667/sshd
I should note that debian has port 80 open as an inbound rule, if that matters.
My question is: what am I doing wrong? Why can't I determine the listening process on port 80? Why is it blocked in Debian? What steps should be taken for the code to work properly?
Brian Yeh Sep 22 '13 at 18:31 2013-09-22 18:31
source share