0

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.

1 Answers1

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
  • 693
  • 1
  • 5
  • 14