try_files and a nested location regexp
igorb
nginx-forum at nginx.us
Thu Oct 16 11:55:48 UTC 2014
Thanks, try_files "" =404 works indeed as long as the regexp location block
contains the necessary alias. I.e. the original example modified like in:
server {
listen 8080 default_server;
root /usr/share/nginx/html;
autoindex on;
location /x/ {
alias /test/;
location ~ ^/x/test {
try_files "" =404;
}
}
}
does not work, while the following one with an extra alias works nicely:
server {
listen 8080 default_server;
root /usr/share/nginx/html;
autoindex on;
location /x/ {
alias /test/;
location ~ ^/x/(test.*) {
alias /test/$1;
try_files "" =404;
}
}
}
P.S.
This is indeed a very simplified config. However, even in this form it is
useful as it reports directories matching ^/x/test as not found even with
autoindex on inherited from the server context.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254033,254042#msg-254042
More information about the nginx
mailing list