Answer the question
In order to leave comments, you need to log in
Is there any point in nested locations in nginx for optimization?
Connoisseurs in nginx, tell me please, is there any point in double locations for optimization? Those. first filter by folder and only then use the regular expression
location /static/img/users/ {
location ~ ^/static/img/users/([0-9]+)x([0-9]+)/\.(jpg|png|gif|jpeg)$ {
try_files $uri /index.php?p1=$1&p2=$2&p3=$3;
}
}
location ~ ^/static/img/users/([0-9]+)x([0-9]+)/\.(jpg|png|gif|jpeg)$ {
try_files $uri /index.php?p1=$1&p2=$2&p3=$3;
}
Answer the question
In order to leave comments, you need to log in
First, non-regex locations are checked,mailman.nginx.org/pipermail/nginx-ru/2011-October/...
i.e., prefixes, exact matches (=), and prefixes with no
regular expressions (^~).
Point A. If a location is found and it has nested locations, then the search
moves inwards. Inside, first locations are checked that are
not specified by regular expressions, if found and it has nested ones,
then go to point A. If not found, then locations
with regular expressions are checked. If location is found, then the search stops.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question