How to setup 2 services with same DNS?

1

I had 2 service on a server that run on 2 different port. one of them on port 80 and another on port 3000. I want to address them with same DNS like this:

http://xxx.ttt.yy : the one that run on port 3000

http://xxx.ttt.yy/zzz : the one that run on port 80

what should i do?

Zoha Rad

Posted 2018-11-28T09:33:37.283

Reputation: 13

What operating system and which web server? – harrymc – 2018-11-28T10:08:44.487

@harrymc OS : linux(debian) WS: apache – Zoha Rad – 2018-11-28T10:16:22.527

@harrymc And if it help, I run Filerun on port 80 and swagger-ui on port 3000 – Zoha Rad – 2018-11-28T10:26:00.010

Answers

1

To achieve this with HTTP, you need to run a reverse proxy software (e.g. nginx or Apache with the mod_proxy_http module) on port 80, and configure it to forward requests to other ports.

For example, in nginx,

location / { proxy_pass http://localhost:3000; }

location /zzz/ { proxy_pass http://localhost:81; }

Note: The service that currently uses port 80 will need to be moved to another port first (or at least configured to listen on loopback IP address only).

user1686

Posted 2018-11-28T09:33:37.283

Reputation: 283 655