httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael" <x...@xshellr8.com>
Subject RE: [users@httpd] Wildcards in Name-based Virtual Hosts
Date Tue, 15 Jun 2004 21:56:49 GMT
That's correct, this will not work and you need to specify IP's in it's
place.

So for example:

Listen xxx.xx.xx.x1:80
Listen xxx.xx.xx.x2:80
Listen xxx.xx.xx.x3:80

NameVirtualHost xxx.xx.xx.x1:80
NameVirtualHost xxx.xx.xx.x2:80
NameVirtualHost xxx.xx.xx.x3:80

<VirtualHost xxx.xx.xx.x1:80>
ServerAdmin webmaster@mydomain.com
DocumentRoot /usr/local/www/MyWeb1
ServerName www.mydomain1.com
ErrorLog /var/log/http-mydomain1-error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/http-mydomain1-access.log combined
ServerPath /usr/local
AccessFileName .htaccess
ServerAlias web
</VirtualHost>


<VirtualHost xxx.xx.xx.x2:80>
ServerAdmin webmaster@mydomain.com
DocumentRoot /usr/local/www/MyWeb2
ServerName www.mydomain2.com
ErrorLog /var/log/http-mydomain2-error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/http-mydomain2-access.log combined
ServerPath /usr/local
AccessFileName .htaccess
ServerAlias surf
</VirtualHost>

<VirtualHost xxx.xx.xx.x3:80>
ServerAdmin webmaster@mydomain.com
DocumentRoot /usr/local/www/MyWeb3
ServerName www.mydomain3.com
ErrorLog /var/log/http-mydomain3-error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/http-mydomain3-access.log combined
ServerPath /usr/local
AccessFileName .htaccess
ServerAlias host
</VirtualHost>

Obviously in this scenario you need static IP's

Hope this helps,

Michael

-----Original Message-----
From: Joshua Slive [mailto:joshua@slive.ca] 
Sent: Tuesday, June 15, 2004 2:35 PM
To: 'users@httpd.apache.org'
Subject: Re: [users@httpd] Wildcards in Name-based Virtual Hosts


On Tue, 15 Jun 2004, James Tusini wrote:

> I thought you could put a wildcard in the directive like this:
>
> <VirtualHost *>
> -
> -
> ServerName *.domain.com
> -
> -
> </VirtualHost>
>
> but then www.domain.com will go to the default server, so I have to use a
> ServerAlias instead
>
> Is this correct behaviour or should the wildcard work?

No, the wildcard should not work.  What would a wildcard ServerName
accomplish that you can't do with a ServerAlias?  Perhaps you are looking
for the "UseCanonicalName off" configuration?

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


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