Re: Apache Virtual Hosts How To
* Jaume Teixi (teixi@6tems.com) [000324 19:29]:
> Whats the nice dynamically configured httpd.conf that could handle the
> following
>
> root.domain.com goes to /var/www
> domain.com goes to /var/www
> www.domain.com goes to /var/www/domain
> webs.domain.com goes to /var/www/webs
> www.customer1.com goes to /var/www/webs/www.customer1.com
> customer1.com goes to /var/www/webs/www.customer1.com
> www.customerN.com goes to /var/www/webs/www.customerN.com
> customerN.com goes to /var/www/webs/www.customerN.com
>
You can install the mod_macro.c in your apache and then you can cofigure it like this:
--- cut here ---
### First you define a macro ###
<Macro myStdVirtualHost $vhost $alias $admin $docroot>
<VirtualHost $vhost:80>
Options Indexes IncludesNOEXEC SymLinksIfOwnerMatch -ExecCGI MultiViews
ServerName $vhost
ServerAlias $alias
ServerAdmin $admin
DocumentRoot $docroot
</VirtualHost>
</Macro>
### if you have a lot of customer you can define a new macro Ex:
<Macro myStdCustomer $customer>
<VirtualHost $customer.com:80>
Options Indexes IncludesNOEXEC SymLinksIfOwnerMatch -ExecCGI MultiViews
ServerName $customer.com
ServerAlias www.$customer.com
ServerAdmin www@$customer.com
DocumentRoot /var/www/webs/www.$customer.com
</VirtualHost>
</Macro>
### next define your Virtuals ###
Use myStdVirtualHost "root.domain.com" "domain.com" "www@domain.com" "/var/www"
Use myStdVirtualHost "www.domain.com" "www.domain.com" "www@www.domain.com" "/var/www/domain"
Use myStdVirtualHost "webs.domain.com" "webs.domain.com" "www@webs.domain.com" "/var/www/webs"
Use myStdCustomer "customer1"
.
.
.
Use myStdCustomer "customerN"
--- cut here ---
FranCHo
--
<<< Net.Zaragoza@FchX >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
---
Nunca sabes quién tiene razón, siempre sabes quién manda.
(Ley de Whistler)
---
Reply to: