Nested Locations Better???
Dayo
nginx-forum at nginx.us
Sat Feb 12 22:33:31 MSK 2011
Just noticed that in Igor's response to an earlier query of mine on a
separate issue, he took code I had shown effectively as ...
[code]
location /set/subset/ {
abc;
}
location /set/ {
xyz;
}
[/code]
... and wrote it like this in his response ...
[code]
location /set/ {
location /set/subset/ {
abc;
}
xyz;
}
[/code]
I had put the first location block on top so that it would be processed
since both would match but now wondering if the nested version is more
efficient.
I had been under the impression that nested locations were to be avoided
but seeing Igor writting the code in that manner got me wondering.
Is it better to have them all independent as I had originally shown were
Nginx would match against the two in some cases and then choose the
closest match out of the two, or the second, nested version where it
will always match the broader location and then sometimes also match the
tighter location inside?
Also, how many layers deep can this go if so?
Thanks
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,174517,174517#msg-174517
More information about the nginx
mailing list