Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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** ->

**Web Browser** -> Displays HTML Page

I am attempting to do this by using the following VirtualHosts in Apache:

Listen 25565

<VirtualHost *:80>
        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all

<VirtualHost *:25565>

        ProxyPass               /       http://localhost:25465          retry=1 acquire=3000 timeout=6$
        ProxyPassReverse        /       http://localhost:25465 


Running this configuration when I browse to I am able to see the files in the /var/www/ 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: ->

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?

share|improve this question
up vote 2 down vote accepted

The Minecraft server protocol isn't HTTP so you can't proxy the requests like that.

Assuming you're on Linux, use iptables to forward the TCP port. You can still run Apache on port 80 on the same IP, but remove the Listen directive and respective vhost in your config there.

IPTables rule should look something like:

iptables -t nat -A PREROUTING -p tcp -d --dport 25565 -j DNAT --to

Remember to actually allow the traffic with an entry in the INPUT/OUTPUT chain too of course.

share|improve this answer
The thing with this is it will foreward all traffic on the IP, so will direct to the same thing as, which I do not want, due to the fact that I may have -> 25465 -> 25365 – Matt Clark Nov 25 '12 at 4:48

iptables -t nat -A PREROUTING -p tcp -d --dport 25565 -j DNAT --to

Where is the IP address of

NOTE THAT YOU CANNOT USE VIRTUAL HOSTING FOR THIS. If you wanted to host and on the same public IP, both to do this kind of port-level redirection... sorry, ain't gonna happen. This stuff happens before the HTTP layer, so virtual hosting is irrelevant to it. :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.