Routing incoming port 80 traffic to new port
I am running Apache2 for my HTTP server. I also have an ssh server running and multiple Minecraft servers running. I've been trying to figure out how to make it so people connecting to my minecraft servers just have to use a url and not a url and a port.
Example: Using URL:Port www.example.com:25565 Usomg URL:Port www.example.com:25566 Using URL www.example.com/vanilla Using URL www.example.com/Pixelmon So how would I accomplish routing these certain URL's to different ports so people can connect just using a URL? I have seen stuff that uses nginx to reverse proxy, but I was never able to get it to work. |
well , in your web server root folder ( or in virtual host .. depending ) make some folders named vanilla and Pixelmon ..
inside create index.php edit index.php Code:
any client clicking example.com/vanilla will be redirected towards domain':'port same with Pixelmon but change port number same trick can be used for domain/webmail , domain/games domain/anything redirecting to another ip or domain make sure you change folder permissions recursively to 744 just to be safe !!! (all->owner ; read ->group ; read->world ) using Code:
chmod -R 744 folder_name |
Thanks yo8rxp
Thank you so much this is the easiest thing I have found or have been given so far and I've been trying to figure this out for months.
|
Minecraft connects through port 25565
So it did work for me and when I used the URL in a web browser it routed me to the URL+port, but since Minecraft tries to connect with port 25565 it didn't work for that. So I now have Apache listening on ports 80 and 25565, so when Minecraft tries to connect with port 25565 using the URL it would be redirected to a different port 25566.
This isn't working though. Am I going about this correctly or am I missing something? I have Apache listening on ports 80 and 25565, I have one server running on port 25566 and the other running on port 25567. I checked if I was routed correctly and I was, all the ports I am using are all open on my modem and computer. Should this work or should it not? I must be missing something. |
1 Attachment(s)
Wow , you lost me into the darkness !
25576 , 25566, 25565, 3 servers ,,, could ya clear me up ? sometimes if you test port forwarding behind the router , it can hit you on the walls instead of local IP ... for exmple my web is running on 192.168.4.100 and 192.168.4.1 ( router ) forwarding incoming 80 port to it. but from a a second PC say 192.168.4.22 if trying to hit 89.120.186.195 or domain name , it wont respond web server but router management itself...(had to build a local DNS server to fix this ) In simple words , some routers will port forward only external connections, not local ones . test it using a mobile connection or ask a friend there is a free tool : canyouseeme dot org where can test ports and / or open services Best of all , try posting here a schematic or a diagram to understand better . try using less words as I am from Romania eastern Europe so i might be difficult understanting i attached a picture here , tell me if it is correct |
Yes that looks correct, but I think the connection out from the Minecraft server needs to be 25565. Explanation below.
ok here are the ip and stuff. External ip: 65.130.33.25 Computer ip: 192.168.0.12 The first Minecraft server is listening on port: 25566 The second Minecraft server is listening on port: 25567 Appache is listening on ports: 80 and 25565 When trying to connect to a Minecraft server Minecraft uses port 25565 by default. That is why Appache is listening to port 25565. Appache would receive the traffic from Minecraft and the index.php (you told me about) would route it to one of the Minecraft servers ports. When using the URL I want to forward to a different port in a web browser it works it tries to connect to the URL:Port. When trying to use the URL to connect to a Minecraft server Minecraft cannot establish a connection. This is the same for when I use some PHP code to get server info. the forwarding works, but the connection can not be established. The "...." are to hold the whitespace. ................................................................|--URL--Index.php-->Minecraft--Server--Port:25566 ................................................................| Computer--Minecraft--Port:25565-->Server----| ................................................................| ................................................................|--URL--Index.php-->Minecraft--Server--Port:25567 Minecraft---Server---Port:25566--->Server-------->Port:25565----Minecraft----Computer Minecraft---Server---Port:25567--->Server-------->Port:25565----Minecraft----Computer |
yes , just because php redirect i ve told ya about , works only in php enabled browsers , minecraft probably (sure ) does not know how to interpret php in order to initiate a connection .
if having more than one public IP , the it would've been simple like port forwarding in 25565 out 25566 for one IP, and 25565 in 25567 for the second IP , but you only got one public IP available have to rethink another solution ... it might take a while ! dig forward and put here what you got , and together will come up a sollution ! sincerely , Gabriel linux-romania dot com |
well ,from my point of view , you should have a main maincraft server on port 25565 default , and there using some plugins to present to the client different server connection like domain:25567 and domain:25567 that points toward different servers.
Or some tcp sniffer that traps vanila and pixelmon words on port25565 and reroute it in different servers , solution i cannot rely on. Basicaly , like assault cube game main server , where all clients goes , and from there select broadcasted IP : port |
Just to be sure .... minecraft client side is standalone software or just playing live within brower ?
If it is within browser , it should.ve been working by now , if it is a standalone software, then surely not ! |
Minecraft is a game, so yes it is standalone.
I've seen stuff about use nginx as a reverse proxy to route traffic server side, but I never got that working. I've also seen stuff about Apache routing traffic, but I never got that working either. I have not got it working to where I want it just using an ip, but I did get it working. The player has to specify the port, but it's better than waiting for another solution to run two servers. The query for my webpage is also working. If your willing to help me out though I would love to still try and figure out if this is possible. |
This isn't really my kind of thing, but it reminds me of threads I've seen where the answer is mod-rewrite in Apache.
HTH :) |
All times are GMT -5. The time now is 11:24 AM. |