httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Tusini <ja...@homehouse.co.uk>
Subject RE: [users@httpd] Wildcards in Name-based Virtual Hosts
Date Wed, 16 Jun 2004 17:17:39 GMT
yes, but thanks anyway

James

-----Original Message-----
From: Joey Hewitt [mailto:joey@joeyhewitt.com]
Sent: 17 June 2004 12:25
To: users@httpd.apache.org
Subject: Re: [users@httpd] Wildcards in Name-based Virtual Hosts


James Tusini <james@homehouse.co.uk> wrote:

> Thanks for the reply. I'm not sure my post was so clear because I put a
> wildcard in the VirtualHost Directive as well as in the ServerName.
>
> I just want to make sure that both http://www.mydomain.com and
> http://mydomain.com is handled by the same VirtualHost. I am not using IP
> based Virtual Hosts (for now anyway ) just Name-based. I Was just
wondering
> what the most efficient/clean way of doing this was.
>
> It looks like you cannot put wilcards in the ServerName configuration
> because it wouldn't make much sense. After Re-reading the docs the penny
> drops.
>

I wasn't sure if you concluded this already, but you'll want something like

ServerName www.mydomain.com
ServerAlias mydomain.com

in your vhost.  (Switch the part after ServerName and ServerAlias around if
you prefer.  This only really matters if you want to have a canonical name -
see "UseCanonicalName" in the docs for a place to start reading about that.)
HTH,
==Joey

> J
>
>
> -----Original Message-----
> From: Michael [mailto:xeon@xshellr8.com]
> Sent: 15 June 2004 22:57
> To: users@httpd.apache.org
> Subject: RE: [users@httpd] Wildcards in Name-based Virtual Hosts
>
>
> 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