Nginx: how to get filename from the request?

Good afternoon, prompt, how in the config to get the file name from the request (without paths)?
October 8th 19 at 03:03
3 answers
October 8th 19 at 03:05
if ($uri ~ "^(.+\.php)") {
set $script $1;
}

something like this?
Work the same as it was in the URI .+ will take it all from the beginning "^.+\\([^\\]+)$" so then somehow - aniya.Kertzmann65 commented on October 8th 19 at 03:08
October 8th 19 at 03:07
Try to use the variable $fastcgi_script_name
October 8th 19 at 03:09
map $request_filename $base_file_name {
 default "";
 ~(?P[^/]+)$ $f;
}


or

if ($request_filename ~ "([^/]+)$") {
 set $base_file_name $1;
}

Find more questions by tags Nginx