One last question about root captures/etc.
Igor Sysoev
is at rambler-co.ru
Mon May 4 12:19:07 MSD 2009
On Mon, May 04, 2009 at 01:13:58AM -0700, Michael Shadle wrote:
> The first one always gets matched. Is there a way to make nginx use
> the one that matches the best?
>
> i.e.
>
> foo123.mike.bar.com should go to #2
> foo.mike.bar.com should go to #2
> blah.mike.bar.com should go to #1
>
> etc.
>
> i've tried in opposite order but it seems that it always sides with
> the more generic one, which does make sense i suppose but perhaps
> there is a way around it?
>
> thanks.
>
>
> server {
> listen 80;
> index index.php index.html;
> server_name ~^(.*?)\.mike\.bar\.com$;
> set $name $1;
> root /home/mike/web/$name;
> location / { }
> }
>
>
> server {
> listen 80;
> index index.php index.html;
> server_name ~^foo(.*?)\.mike\.bar\.com$;
> set $name $1;
> root /home/mike/web/foo$name;
> location / { }
> }
Regexs in server names are run in order of their appearence.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list