PDA

View Full Version : Set up subdomains


cheezy
13th April 2008, 12:40
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?

Puthuff
14th April 2008, 06:17
using dns make A records for the sub domains

zcworld
14th April 2008, 07:35
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

cheezy
14th April 2008, 18:34
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!

paulororke
14th May 2008, 00:37
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 ProxyPreserveHost On to my virtual host config. Now the site rockets where it had been painfully slow and CSS was missing.

This forum rocks!