try_files and a nested location regexp

Edho Arief me at myconan.net
Thu Oct 16 11:40:06 UTC 2014


On Thu, Oct 16, 2014 at 8:25 PM, igorb <nginx-forum at nginx.us> wrote:
> I tried that, but it still does not work. The following config as before
> still gives 404 for localhost/x/test.html :
>
> server {
>         listen 8080 default_server;
>         root /usr/share/nginx/html;
>         autoindex on;
>
>         location /x/ {
>                 alias /test/;
>         }
>
>         location ~ ^/x/(test.*)$ {
>                 alias /test/$1;
>                 try_files /test/$1 =404;
>         #       try_files $uri =404;
>         }
> }
>

Have you tried removing the alias?

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



More information about the nginx mailing list