Set up subdomains

Discussion in 'Server Operation' started by cheezy, Apr 13, 2008.

  1. cheezy

    cheezy New Member

    Hello,

    I want to make the following happen:

    I have somedomain.com and want to create subdomains. I already saw that you can do that with Apache using VirtualHosts but then you can only specify a DocumentRoot. What I want is some kind of forward to another IP address in the same network. Example:
    sub1.somedomain.com -> 192.168.0.1:80
    sub2.somedomain.com -> 192.168.0.2:7777
    etc...

    Can anybody tell me how to set something like this up? Can it be done with Apache? Or is it something my router should handle?
     
  2. Puthuff

    Puthuff New Member

    using dns make A records for the sub domains
     
  3. zcworld

    zcworld New Member

    ok personal i would use an proxy mod in apche

    where i setup an vhost for that sub2
    and forward it to the other box inside my network / port

    and its just sub2.mysite.com = 192.168.0.2:777 *inside the network*

    last thing you want is to remember ports for normal users
    UNLESS its an admin / private / test / other site
     
  4. cheezy

    cheezy New Member

    Thanks for the advice to use mod proxy! I didn't hear about this one yet. I started looking for how to configure that and ended up with:

    <VirtualHost *>
    ServerName sub1.somedomain.com
    ProxyPreserveHost On
    ProxyRequests Off
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    ProxyPass / http://192.168.0.1:777/
    ProxyPassReverse / http://192.168.0.1:777/
    </VirtualHost>

    For each subdomain I configured a VirtualHost like this. Thanks!
     
  5. paulororke

    paulororke New Member

    performace on reverse proxy.

    So glad to have found this post. I was having a terrible time trying to get this working until I saw this post and added the line
    Code:
    ProxyPreserveHost On
    to my virtual host config. Now the site rockets where it had been painfully slow and CSS was missing.

    This forum rocks!
     

Share This Page