0

I Just want to know,can I run my node app on any port is less then 100 if yes then what is the problem will come any performance Issue or system Issue .

Nitesh singh
  • 915
  • 11
  • 21
  • Yes, surely you can listen on any free port. Try listening at port `80`. – vibhor1997a Jun 29 '18 at 05:54
  • @vibhor1997a certain ports are reserved as system ports in most OS these days and require certain settings by admins for this – Robert Mennell Jun 29 '18 at 05:55
  • @nitesh_singh you should check on Server Fault for questions like `How do I run an application on a reserved system port?` – Robert Mennell Jun 29 '18 at 05:56
  • @Robert Mennell what happen if i used reserved as system ports I just want to know – Nitesh singh Jun 29 '18 at 05:57
  • @niteshsingh it'll reject the attempt to bind since that's an OS operation. Can is very different form what and should probably be the real subject of the title – Robert Mennell Jun 29 '18 at 05:58
  • @vibhor1997a you are not right I know I can run on port 80. but if I use other port instead of 80 when that port was free and then system what to use that post then what will happen – Nitesh singh Jun 29 '18 at 05:59
  • 1
    80 is reserved for a HTTP server; a node server is typically exactly that, so there should be no issues (as long as you are able to bind, i.e. you're `root` and no-one's bound on port 80 yet, like Apache or Nginx or another node.js app). If you bind on 25, it will probably fail because your mail delivery agent is probably already listening there. If you try 22, you might be getting noise if people try to `ssh` to your server. Etc, etc... Every port is a different story, since every port is reserved for a different service. – Amadan Jun 29 '18 at 06:04
  • @Amadan why not just put that as notes in your answer? – Robert Mennell Jun 29 '18 at 06:05
  • @niteshsingh a bunch of information on it for linux: https://stackoverflow.com/questions/18947356/node-js-app-cant-run-on-port-80-even-though-theres-no-other-process-blocking-t/18947576 – Robert Mennell Jun 29 '18 at 06:06
  • @RobertMennell Thanks I Got the Point from your link – Nitesh singh Jun 29 '18 at 06:14

1 Answers1

0

Ports under 1024 are reserved for root. Most of the sub-100 ones are already being used, or are reserved for, various services necessary for your system's operation, so it is definitely not recommended (take a look at /etc/services, if you're on Unix). However, if you do it anyway, there will be no performance penalty.

Amadan
  • 191,408
  • 23
  • 240
  • 301
  • What if they're on windows? – Robert Mennell Jun 29 '18 at 05:55
  • 1
    @RobertMennell: Good point. No idea, I'm not a Windows person, but I imagine it will be similar, with privileged ports being restricted in some way from ordinary users. – Amadan Jun 29 '18 at 06:01
  • Worse part? I'm crawling ALL over server fault and power user for that question and it's been buried... I guess it's been lost to the world of non google – Robert Mennell Jun 29 '18 at 06:02