You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Callum Scott <sc...@gmail.com> on 2011/04/19 13:38:36 UTC

[users@httpd] Wildcard and Specific Vhosts

Hi All,

I am trying to get the following to work.  www.domain.co.uk domain.com to go
to /home/somedir1 and then *.domain.com to go to /home/somedir2 however this
doesn't appear to be working as expceted.  To difirenciate I have the two
vhosts pointing to seperate logfiles and it appears that if I try to go to
say cheese.domain.com I am being directed to /home/somedir1 as opposed to
/home/somedir2.  My vhost.conf file is below, any pointers would pe
appreciated.  Is it that I actually need to use a seperate ip address for
the wildcard domain?


NameVirtualHost <ip.add.re.ss>:80

<VirtualHost<ip.add.re.ss>:80>
        ServerName www.domain.co.uk
        ServerAlias subdomain.domain.co.uk domain.co.uk
        ServerAdmin admin@address
        DocumentRoot /home/somedir1
        CustomLog /home/logs/domain.co.uk/access_log combined
        ErrorLog  /home/logs/domain.co.uk/error_log
</VirtualHost>

<VirtualHost<ip.add.re.ss>:80>
        ServerName *.domain.co.uk
        ServerAdmin admin@address
        DocumentRoot /home/somedir2
        CustomLog /home/logs/domain.co.uk/wild_access_log combined
        ErrorLog  /home/logs/domain.co.uk/wild_error_log
</VirtualHost>

By my reckoning this should work fine.  I haven't seen anything that
suggests that this is not possible.

Thanks in advance.
-- 
Callum

Re: [users@httpd] Wildcard and Specific Vhosts

Posted by Eric Covener <co...@gmail.com>.
> I went back and re-read the docs which do not explicitly say that the
> ServerName connot be a wild card.  It says it "should" be explicit.
>
> Are the docs incorrect or is there something specific about this setup that
> required it to be an ailias?

The doc says it's a domain name / hostname without any reference to
wildcards, regular expressions, variable interpolation...

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] Wildcard and Specific Vhosts

Posted by Callum Scott <sc...@gmail.com>.
> Make this a ServerAias and set a normal ServerName -- ServerName can't
> be a wildcard.
>
> ---------------------------------------------------------------------
> 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
>
>
Thanks Eric,

That has worked.

I went back and re-read the docs which do not explicitly say that the
ServerName connot be a wild card.  It says it "should" be explicit.

Are the docs incorrect or is there something specific about this setup that
required it to be an ailias?

Regards
-- 
Callum

Re: [users@httpd] Wildcard and Specific Vhosts

Posted by Eric Covener <co...@gmail.com>.
On Tue, Apr 19, 2011 at 7:38 AM, Callum Scott <sc...@gmail.com> wrote:
> Hi All,
>
> I am trying to get the following to work.  www.domain.co.uk domain.com to go
> to /home/somedir1 and then *.domain.com to go to /home/somedir2 however this
> doesn't appear to be working as expceted.  To difirenciate I have the two
> vhosts pointing to seperate logfiles and it appears that if I try to go to
> say cheese.domain.com I am being directed to /home/somedir1 as opposed to
> /home/somedir2.  My vhost.conf file is below, any pointers would pe
> appreciated.  Is it that I actually need to use a seperate ip address for
> the wildcard domain?
>
>
> NameVirtualHost <ip.add.re.ss>:80
>
> <VirtualHost<ip.add.re.ss>:80>
>         ServerName www.domain.co.uk
>         ServerAlias subdomain.domain.co.uk domain.co.uk
>         ServerAdmin admin@address
>         DocumentRoot /home/somedir1
>         CustomLog /home/logs/domain.co.uk/access_log combined
>         ErrorLog  /home/logs/domain.co.uk/error_log
> </VirtualHost>
>
> <VirtualHost<ip.add.re.ss>:80>
>         ServerName *.domain.co.uk

Make this a ServerAias and set a normal ServerName -- ServerName can't
be a wildcard.

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