need to preserve / in location

Gregory Edigarov edigarov at qarea.com
Wed Apr 22 09:18:38 UTC 2020


On 2020-04-22 11:46, Gregory Edigarov wrote:
> Hello, Everybody
>
> this is directory structure:
>
> /front/admin/index.html
>
> /front/superadmin/index.html
>
> that's what I have in config
>
>     rewrite ^/(admin)$ /$1/ last;
>     location /admin/ {
>         index index.html;
>         root /front;
>         try_files $uri  admin/index.html;                 #direct all 
> request to index.html
>    }
>
> and the errors:
>
> 2020/04/22 08:35:13 [error] 73#73: *1 open() "/frontindex.html" failed 
> (2: No such file or directory), client: 192.168.224.1, server: , 
> request: "GET /admin HTTP/1.1", host: "127.0.0.1"
> 192.168.224.1 - - [22/Apr/2020:08:35:13 +0000] "GET /admin HTTP/1.1" 
> 404 146 "-" "curl/7.58.0" "-"
>
> 2020/04/22 08:35:24 [error] 73#73: *2 open() "/frontindex.html" failed 
> (2: No such file or directory), client: 192.168.224.1, server: , 
> request: "GET /admin/ HTTP/1.1", host: "127.0.0.1"
> 192.168.224.1 - - [22/Apr/2020:08:35:24 +0000] "GET /admin/ HTTP/1.1" 
> 404 146 "-" "curl/7.58.0" "-"
>
> what's the right config in situation given?
>
forgot to say:

I also have "root /front;" directive in upper level

> -- 
>
> With best regards,
>
>         Gregory Edigarov
>


More information about the nginx mailing list