Y
Y
Yuri Chernyshev2012-02-22 14:55:27
Nginx
Yuri Chernyshev, 2012-02-22 14:55:27

Nginx: how to get filename from request?

Good afternoon, tell me how to get the file name from the request in the config (without paths)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
warsoul, 2012-02-22
@warsoul

if ($uri ~ "^(.+\.php)") {
set $script $1;
}
something like this?

M
Maximus43, 2012-02-22
@Maximus43

Try using $fastcgi_script_name variable

V
VBart, 2012-02-22
@VBart

map $request_filename $base_file_name {
   default "";
   ~(?P<f>[^/]+)$ $f;
}

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question