title: How to forward a subdomain to a new port on the same IP address using Apache?
body: <p>I have a NAS/Server running at home 24/7 and run many different services on it.  I have got a domain name pointing to it now, and was wondering if it would be possible to create sub-domains that point to different ports for different services.  For example:</p>
  
  <ul>
  <li><a href="http://subsonic.mydomain.com">http://subsonic.mydomain.com</a> --> XXX.XXX.XXX.XXX:4040</li>
  <li><a href="http://minecraft.mydomain.com">http://minecraft.mydomain.com</a> --> XXX.XXX.XXX.XXX:25565</li>
  <li><a href="http://files.mydomain.com">http://files.mydomain.com</a> --> XXX.XXX.XXX.XXX:4082</li>
  </ul>
  
  <p>I have a single D-LINK router that currently port forwards all these ports to my NAS/Server whose IP is 192.168.0.104.</p>
  
  <p>EDIT: The server is running Ubuntu 12.04.</p>
  
  <p>What service or proxy do I need to run that can recognize the sub domain and route the traffic accordingly?  Or could I use apache virtual hosts to handle this, because these subdomains will come in on port 80, which apache is listening to?  Or does virtual hosts not work like this?</p>
  
  <p>Any information, ideas, or tips would be helpful/useful.</p>