One last question about root captures/etc

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 / { }
}

On Mon, May 04, 2009 at 01:13:58AM -0700, Michael S. wrote:

   server_name ~^(.*?)\.mike\.bar\.com$;
    set $name $1;
    root /home/mike/web/foo$name;
   location / { }

}

Regexs in server names are run in order of their appearence.

How about location block? Merged or in order of their appearence

i.e.

location /aa {
conf1
}
location /bb {
conf2
}
location /aa {
conf3
}

if request uri is /aa, what’s the conf is ?

2009/5/4 Igor S. [email protected]

2009/5/4 Igor S. [email protected]:

Regexs in server names are run in order of their appearence.

are you sure? i tried different order and it still matched the same
default one.

i am working on hostname based regexs, not location based ones…

On Mon, May 04, 2009 at 04:29:41PM +0800, Delta Y. wrote:

location /aa {
conf3
}

if request uri is /aa, what’s the conf is ?

nginx 0.7 exits with error about duplicate location.

nevermind.

i think this might be working now. maybe i had something else going on.

ignore me :slight_smile:

dear all:

    i want to limit the total bandwidth  outgoing

   do nginx support this module ?

i use the iptables+tc to do this before