In my VM, i'm running both apache2
and nginx
, but apache2 is pointed to Port 8080 and nginx is Port 80. Already i pointed my domain to ip in nginx and its running properly. The same thing i need to do for apache2. But how will i give Port number
while mapping the ip to Domain
. In the cName record, i'm not able to specify the port. Is there any alternative way to resolve this issues.
Asked
Active
Viewed 3,204 times
0

Sakthi Panneerselvam
- 135
- 1
- 7
-
2You can't. DNS doesn't handle ports. – Gerald Schneider May 15 '19 at 07:39
1 Answers
1
DNS CNAME record resolves only to IP address, so you cannot specify port, you have to explicitly add port to your URL in a request like this: http://example.com:8080.
Another approach is to use load balancer like for example Haproxy, Traefic, or even Nginx with its reverse proxy capabilities (check this: http://nginx.org/en/docs/http/load_balancing.html). Then you will be able to use only one port (well, you can use multiple ports as well, but typically port 80 and 443) on its frontend traffic and "routing" it to your backends by some criteria (domain name, path, HTTP header info, cookies, source or destination IP address, etc.).

patok
- 692
- 1
- 5
- 15