Apache Server Redirect Subdomain to Port
- by Matt Clark
I am trying to setup my server with a Minecraft server on a non-standard port with a subdomain redirect, which when navigated to by minecraft will go to its correct port, or if navigated to by a web browser will show a web-page. i.e.:
**Minecraft**
minecraft.example.com:25565 -> example.com:25465
**Web Browser**
minecraft.example.com:80 -> Displays HTML Page
I am attempting to do this by using the following VirtualHosts in Apache:
Listen 25565
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName minecraft.example.com
DocumentRoot /var/www/example.com/minecraft
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/example.com/minecraft/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:25565>
ServerAdmin [email protected]
ServerName minecraft.example.com
ProxyPass / http://localhost:25465 retry=1 acquire=3000 timeout=6$
ProxyPassReverse / http://localhost:25465
</VirtualHost>
Running this configuration when I browse to minecraft.example.com I am able to see the files in the /var/www/example.com/minecraft/ folder, however if I try and connect in minecraft I get an exception, and in the browser I get a page with the following information:
minecraft.example.com:25565 ->
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.
Reason: Error reading from remote server
Could anybody share some insight on what I may be doing wrong and what the best possible solution would be to fix this? Thanks.