httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <Owen.Bo...@swx.com>
Subject RE: [users@httpd] 3 sites, same virtual host
Date Wed, 22 Nov 2006 12:52:33 GMT
> -----Original Message-----
> From: clodoaldo.pinto@gmail.com 
> [mailto:clodoaldo.pinto@gmail.com] On Behalf Of Clodoaldo
> Sent: Wednesday, November 22, 2006 1:35 PM
> To: users@httpd.apache.org
> Subject: [users@httpd] 3 sites, same virtual host
> 
> I have 3 sites and one virtual host for each of them. They are Drupal
> sites sharing the same document root but with different databases.
> 
> The vhosts are like this:
> 
> <VirtualHost 1.2.3.4:80>
>    ServerName my_site_1.net
>    DocumentRoot /var/www/html/my_site
>    ErrorLog logs/my_site_1-error_log
>    CustomLog logs/my_site_1-access_log combined
>    ... # many lines here
> </VirtualHost>
> 
> I would like to make it one only virtual host for all the three. They
> are almost the same except for the log files. I would like to have
> something like this:
> 
> <VirtualHost 1.2.3.4:80>
>    ServerName my_site_1.net
>    ServerAlias my_site_2.net
>    ServerAlias my_site_3.net
>    DocumentRoot /var/www/html/my_site
> 
>    If (domain == 'my_site_1.net') {
>       ErrorLog logs/my_site_1-error_log
>       CustomLog logs/my_site_1-access_log combined
>    }
>    else If (domain == 'my_site_2.net') {
>       ErrorLog logs/my_site_2-error_log
>       CustomLog logs/my_site_2-access_log combined
>    }
>    else {
>       ErrorLog logs/my_site_3-error_log
>       CustomLog logs/my_site_3-access_log combined
>    }
> 
>    ... # many lines here
> </VirtualHost>
> 
> Obviously i know there are no if() commands. It is just to 
> show what i want.

The basic apache config can't do this - it's just a flat text file with
no conditional syntax.

Alternative ideas:

- use a perl-script or equivalent to write out the config at runtime
(eg, as the first step in apachectl).
- Look for a third-party module (see http://modules.apache.org/), eg:
http://www.coelho.net/mod_macro/

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

> 
> Regards,
> -- 
> Clodoaldo Pinto Neto
> 
> ---------------------------------------------------------------------
> 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
>
 
 
This message is for the named person's use only. It may contain confidential, proprietary
or legally privileged information. No confidentiality or privilege is waived or lost by any
mistransmission. If you receive this message in error, please notify the sender urgently and
then immediately delete the message and any copies of it from your system. Please also immediately
destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail communications through their
networks. Any views expressed in this message are those of the individual sender, except where
the message states otherwise and the sender is authorised to state them to be the views of
the sender's company.

---------------------------------------------------------------------
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


Mime
View raw message