Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run node.js webbapp on 80 port on windows

I need to make my local node.js webapp listen 80 port. Now if run my app on port 80 I get this erro

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> (\scripts\server.js:23: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) 

And if run app on 4321 port this error do not reproduced, so it's port depending.

What should I do to be able run my app on port 80 on Windows 7

like image 593
silent_coder Avatar asked Sep 26 '13 13:09

silent_coder


People also ask

Can I run NodeJS on port 80?

We know that most of the time we want our node applications to listen on port 80. While it is a widely used technique and many times we don't need anything else then just simply mentioning the port as 80 in our project configurations.

How do I make node listen on port 80?

const server = http. createServer((req,res)=>{ // Handle request and response }); Specify Port Number and hostname and set the server to listen to it. server.


2 Answers

On windows machine you 80 port probably busy with IIS Server. Try to stop iis first and after run node.js webapp with port 80.

like image 128
Ph0en1x Avatar answered Sep 16 '22 13:09

Ph0en1x


IIS on 80 port is definitely issue. And instead of turning it of you can try IIS node. http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx Probably you don't need port 80 in local development at all, but if you go in production on Windows machine IIS Node is good choice to load balance.

like image 20
Serhii Kuts Avatar answered Sep 17 '22 13:09

Serhii Kuts