Can I configure a subdomain to point to a specific

2019-03-08 10:20发布

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 :)

5条回答
我想做一个坏孩纸
2楼-- · 2019-03-08 10:45

I... don't think so. You can redirect the subdomain (such as blah.something.com) to point to something.com:25566, but I don't think you can actually set up the subdomain to be on a different port like that. I could be wrong, but it'd probably be easier to use a simple .htaccess or something to check %{HTTP_HOST} and redirect according to the subdomain.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-03-08 10:52

If you only got one IP on the server, there is no chance to do that. DNS is a simple name to number (IP) resolver. If you have two IPs on the server, you can point each subdomain to each of the IP-addresses and run both servers on the default port on each IP.
one.example.com -> 127.0.0.1 (server: 127.0.0.1:25565)
two.example.com -> 127.0.0.2 (server: 127.0.0.2:25565)

查看更多
对你真心纯属浪费
4楼-- · 2019-03-08 10:54

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

查看更多
▲ chillily
5楼-- · 2019-03-08 10:56

If the registrar offers URL Redirect Records, you can redirect sub.domain.tld to domain.tld:subport. This probably won't produce the desired result in Minecraft, but it will work for browsers.

e.g. I run Webmin and Usermin on 10000 and 20000 respectively, and use webmin.domain.tld and usermin.domain.tld to redirect to the correct port so users don't have to remember them.

查看更多
Melony?
6楼-- · 2019-03-08 11:08

With only 1 IP you can forget DNS but you can use a MineProxy because the handshake packet of the client contains the host that then he connected to and a MineProxy will ready this host and proxy the connection to a server that is registered for that host

查看更多
登录 后发表回答