How about location block? Merged or in order of their appearence<br><br>i.e.<br> <br> location /aa {<br> conf1<br> }<br> location /bb {<br> conf2<br> }<br> location /aa {<br> conf3<br> }<br><br><br>if request uri is /aa, what's the conf is ?<br>
<br><div class="gmail_quote">2009/5/4 Igor Sysoev <span dir="ltr"><<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Mon, May 04, 2009 at 01:13:58AM -0700, Michael Shadle wrote:<br>
<br>
> The first one always gets matched. Is there a way to make nginx use<br>
> the one that matches the best?<br>
><br>
> i.e.<br>
><br>
> <a href="http://foo123.mike.bar.com" target="_blank">foo123.mike.bar.com</a> should go to #2<br>
> <a href="http://foo.mike.bar.com" target="_blank">foo.mike.bar.com</a> should go to #2<br>
> <a href="http://blah.mike.bar.com" target="_blank">blah.mike.bar.com</a> should go to #1<br>
><br>
> etc.<br>
><br>
> i've tried in opposite order but it seems that it always sides with<br>
> the more generic one, which does make sense i suppose but perhaps<br>
> there is a way around it?<br>
><br>
> thanks.<br>
><br>
><br>
> server {<br>
> listen 80;<br>
> index index.php index.html;<br>
> server_name ~^(.*?)\.mike\.bar\.com$;<br>
> set $name $1;<br>
> root /home/mike/web/$name;<br>
> location / { }<br>
> }<br>
><br>
><br>
> server {<br>
> listen 80;<br>
> index index.php index.html;<br>
> server_name ~^foo(.*?)\.mike\.bar\.com$;<br>
> set $name $1;<br>
> root /home/mike/web/foo$name;<br>
> location / { }<br>
> }<br>
<br>
</div></div>Regexs in server names are run in order of their appearence.<br>
<font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</font></blockquote></div><br>