try_files and a nested location regexp

igorb nginx-forum at nginx.us
Thu Oct 16 11:09:44 UTC 2014


I tried to add explicit alias to the regexp location:

server {
        listen 8080 default_server;
        root /usr/share/nginx/html;
        autoindex on;

        location /x/ {
                alias /test/;
        }

        location ~ ^/x/(test.*)$ {
                alias /test/$1;
                try_files $uri =404;
        }
}

However that still gives 404 for localhost/x/test.html . Does that mean that
try_files cannot be used at all in a regexp location defined with an alias,
it only works if the location uses the root directive?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254033,254035#msg-254035



More information about the nginx mailing list