need to preserve / in location

Gregory Edigarov edigarov at qarea.com
Wed Apr 22 08:46:25 UTC 2020


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?

--

With best regards,

         Gregory Edigarov



More information about the nginx mailing list