You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Clodoaldo <cl...@gmail.com> on 2006/11/22 13:34:30 UTC

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

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