How to redirect subdomain to fixed IP on specific port

Asked

Viewed 12,681 times

3

I am using a web application that runs on port 8180 and would like to redirect my subdomain to my server IP on port 8180. In the DNS zones, I created a type A entry, but I can only inform the IP, and port is not working.

How to do this redirect, ie when typing service.meusite.com.br it will redirect to my server on port 8180 getting something like 123.45.678.90:8180?

1 answer

4

This you want to do, cannot be done with DNS only. DNS solves only addresses, not ports. To redirect HTTP to another port, you need an HTTP server. So we have two alternatives.

If the subdomain address (123.45.678.90) has port 80 free (which I don’t believe is the case, otherwise you wouldn’t want to use port 8180), you should put a web server answering port 80 and redirect any request to http://subdominio.meusite.com.br:8180.

If the subdomain address (123.45.678.90) is already using port 80 for the main domain (I believe this is your case), you should enable the use of Virtual Host on the 80 port server, because then a single Web server can serve several domains at the same address. In a virtual host you put the domain, in the other virtual host the subdomain that redirects everything to :8180.

The virtual host configuration varies according to the web server you are using, so I won’t go into detail.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.