You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Steigerwald <mi...@gmail.com> on 2007/02/18 02:21:51 UTC

[users@httpd] Best practice for setting DocumentRoot based on hostname

Hi all,

Is there a particular best practice for setting DocumentRoot based on
hostname? In my case, I have several domains, e.g., www.agloa.net and
www.mnfatherproject.org served at the same ip address. What's the best way
to use a different DocumentRoot for each?

TIA

Re: [users@httpd] Best practice for setting DocumentRoot based on hostname

Posted by matt farey <ma...@gmail.com>.

Michael Steigerwald wrote:
> Hi all,
>
> Is there a particular best practice for setting DocumentRoot based on
> hostname? In my case, I have several domains, e.g., www.agloa.net
> <http://www.agloa.net> and www.mnfatherproject.org
> <http://www.mnfatherproject.org> served at the same ip address. What's
> the best way to use a different DocumentRoot for each?
>
> TIA
This is really up to you, vhost stanzas could be set up to serve from
/path/to/vhosts/www.domain1/public
/path/to/vhosts/www.domain2/public
etc...

but if you start to have ALOT of domains, check out the "Dynamically
Configured Mass Virtual Hosting" advice on how to distribute your
domains in your filesystem to maximise performance here: (directory name
interpolation)
http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html
and here:
http://httpd.apache.org/docs/2.2/vhosts/mass.html#xtra-conf

you can see that dividing up the subdomains... from the domain and tld
can evenly distribute many vhosts which does help performance, and even
housekeeping!

personally I started my DCMVH using the simpler sytem above using a
virtual document root of
/path/to/vhosts/%0/public
but now there are hundreds of them, and I might have to revist that
decision and spread them out a bit more.
matt

-- 




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org