1

I have a application with UI on Angular and Web API on Nodejs deployed on following Web servers( on the same Windows server say "server1"). Have configured multiple IPs on the server as listed below

  1. UI -- IIS , listening on 10.250.18.51 with port 80 on server1
  2. API -- NodeJs , listening on 10.250.18.52 with port 80 on server1. Ultimately will be using Nginx to forward the request to nodejs

Problem Statement

Not able to run both Nodejs and IIS on port 80 even though both listening to different IPs

  1. IIS error : The port is already used by another process
  2. NodeJs Error : EACCES, Permission denied

Am I missing something ?

Regards

1 Answers1

1

Although they are running on different IP, They are running on the same machine so on the very same machine you can not run two processes on the same node.

As you are using nginx the best solution would be making a reverse proxy for node process.

Use different domains for both processes and use Nginx to forward them like the following:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        server_name www.xxx.me xxx.me;

        # your IIS config for nginx
}

# slack
server {
    listen 80;

    server_name xxx.xxx.me;

    location / {
        proxy_pass http://localhost:7777;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
     }
}

Above snippet assumes that your node process is running on 7777

Ridham Tarpara
  • 5,970
  • 4
  • 19
  • 39
  • link says its possible https://stackoverflow.com/questions/1694144/can-two-applications-listen-to-the-same-port/1694149 – Vipul Patel Aug 27 '18 at 06:46
  • 1
    As per the link **For TCP, no. You can only have one application listening on the same port at one time. Now if you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP using the same port number.** So here windows server in normal case have one network card so it's not possible – Ridham Tarpara Aug 27 '18 at 06:50
  • Kindly refer the question. Have configured two IPs on the Windows server – Vipul Patel Aug 27 '18 at 08:02