You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Busby <bu...@pnts.com> on 2002/10/02 18:39:21 UTC

[users@httpd] Multiple sites with same parameters

List,
	I would like to have multiple sites on one computer use the same virtual 
host data.  That way if someone comes in via IP they get the right site, 
or if they visit by name they also get the correct site.
Maybe I can also use this to disable IP based access?  So how would I 
share that VirtualHost config with more than one NameVirtualHost (if 
possible).  My sample is below

NameVirtualHost 209.202.222.221
NameVirtualHost www.mydomain.com

<VirtualHost 209.202.222.221>
     <Directory "/opt/httpd/www">
     AuthName "system"
     AuthUserFile /opt/httpd/conf/auth_user_file
     AuthType Basic
     Require valid-user
     </Directory>
     ServerName www.mydomain.com
     ErrorLog logs/error_log
     CustomLog logs/access_log common
</VirtualHost>

<VirtualHost www.mydomain.com>
     <Directory "/opt/httpd/www">
     AuthName "system"
     AuthUserFile /opt/httpd/conf/auth_user_file
     AuthType Basic
     Require valid-user
     </Directory>
     ServerName www.mydomain.com
     ErrorLog logs/error_log
     CustomLog logs/access_log common
</VirtualHost>


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


Re: [users@httpd] Multiple sites with same parameters

Posted by Joshua Slive <jo...@slive.ca>.
David Busby wrote:
> List,
>     I would like to have multiple sites on one computer use the same 
> virtual host data.  That way if someone comes in via IP they get the 
> right site, or if they visit by name they also get the correct site.
> Maybe I can also use this to disable IP based access?  So how would I 
> share that VirtualHost config with more than one NameVirtualHost (if 
> possible).  My sample is below
> 
> NameVirtualHost 209.202.222.221
> NameVirtualHost www.mydomain.com

It is hard to tell exactly what you are trying to do, but I suggest you use
NameVirtualHost *

<VirtualHost *>
ServerName 209.202.222.221
...
</VirtualHost>

<VirtualHost *>
ServerName www.mydomain.com
...
</VirtualHost>

The ServerName is what determines which <VirtualHost> servers what 
requests.  (You can use ServerAlias to add additional matches.) 
Requests that don't match any ServerName or ServerAlias will go to the 
first listed VirtualHost.

Joshua.


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