Apache Server Redirect Subdomain to Port

Posted by Matt Clark on Server Fault See other posts from Server Fault or by Matt Clark
Published on 2012-11-24T22:16:56Z Indexed on 2012/11/24 23:05 UTC
Read the original article Hit count: 303

Filed under:
|
|
|
|

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.

© Server Fault or respective owner

Related posts about apache2

Related posts about ubuntu