Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I configure a subdomain to point to a specific port on my server

I have an old computer which I converted into a minecraft server. I have 2 minecraft servers running simultaneously, one on port 25565 (default) and one on port 25566.

I bought the domain something.com and pointed it to my server. Right now, in the game you type something.com to get into the first server and something.com:25566 to get into the other server.

Is there a way to set one.something.com to point to the first server and two.something.com to point to the second server? I own the (centos) server, have root access, and everything else. The domain is controlled by no-ip if that makes a difference. I know that DNS has no relationship to port numbers but if there a program I can install to make this work?

Thanks :)

like image 827
alecwhardy Avatar asked Oct 29 '11 23:10

alecwhardy


People also ask

Can you point a subdomain to a port?

If you are running a web service (that is run on port 80 by default) on your home network computer accessible from the internet, you can redirect your Namecheap domain to an IP address of the server along with a port.

Can a domain point to a specific port?

Domain names don't refer to specific ports. They just refer to IP addresses. The client can look up a hostname to get the IP address which the client should connect to, but the client has to figure out the port without the help of DNS. Port 80 is just the default port for HTTP service.

Can subdomain points to different server?

Yes, It's possible. For Example. You would either Contact your Host to set this, or if you have the ability to point DNS your self then do so. Just make sure that the site you want to serve on that subdomain exists on the server that it's pointing to.

Can you redirect a subdomain?

Under Modify a Subdomain, locate the domain you want to redirect, then click its Manage Redirection link on the right. In the text box, type the URL you would like visitors to be redirected to if they go to the subdomain sample1.hgexample.com. Click Save. You will see the redirected URL under the Redirection column.


1 Answers

If you have access to SRV Records, you can use them to get what you want :)

E.G

A Records

Name: mc1.domain.com Value: <yourIP>  Name: mc2.domain.com Value: <yourIP> 

SRV Records

Name: _minecraft._tcp.mc1.domain.com Priority: 5 Weight: 5 Port: 25565 Value: mc1.domain.com  Name: _minecraft._tcp.mc2.domain.com Priority: 5 Weight: 5 Port: 25566 Value: mc2.domain.com 

then in minecraft you can use

mc1.domain.com which will sign you into server 1 using port 25565

and

mc2.domain.com which will sign you into server 2 using port 25566

then on your router you can have it point 25565 and 25566 to the machine with both servers on and Voilà!

Source: This works for me running 2 minecraft servers on the same machine with ports 50500 and 50501

like image 153
MRVDOG Avatar answered Sep 23 '22 11:09

MRVDOG