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&#39;s the conf is ?<br>
<br><div class="gmail_quote">2009/5/4 Igor Sysoev <span dir="ltr">&lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt;</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>
&gt; The first one always gets matched. Is there a way to make nginx use<br>
&gt; the one that matches the best?<br>
&gt;<br>
&gt; i.e.<br>
&gt;<br>
&gt; <a href="http://foo123.mike.bar.com" target="_blank">foo123.mike.bar.com</a> should go to #2<br>
&gt; <a href="http://foo.mike.bar.com" target="_blank">foo.mike.bar.com</a> should go to #2<br>
&gt; <a href="http://blah.mike.bar.com" target="_blank">blah.mike.bar.com</a> should go to #1<br>
&gt;<br>
&gt; etc.<br>
&gt;<br>
&gt; i&#39;ve tried in opposite order but it seems that it always sides with<br>
&gt; the more generic one, which does make sense i suppose but perhaps<br>
&gt; there is a way around it?<br>
&gt;<br>
&gt; thanks.<br>
&gt;<br>
&gt;<br>
&gt; server {<br>
&gt;        listen 80;<br>
&gt;        index index.php index.html;<br>
&gt;        server_name ~^(.*?)\.mike\.bar\.com$;<br>
&gt;        set $name $1;<br>
&gt;        root /home/mike/web/$name;<br>
&gt;        location / { }<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; server {<br>
&gt;         listen 80;<br>
&gt;         index index.php index.html;<br>
&gt;         server_name ~^foo(.*?)\.mike\.bar\.com$;<br>
&gt;         set $name $1;<br>
&gt;         root /home/mike/web/foo$name;<br>
&gt;        location / { }<br>
&gt; }<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>