A
A
Alexander2017-05-31 20:43:48
Nginx
Alexander, 2017-05-31 20:43:48

Pass string from file to Nginx variable?

Hello! The crux of the matter is this. We have nginx without php and everything else. At a certain request, the server gives the file, let it be file1.txt. This file contains the name of the second file, let's say file2.txt. How can I pass the name of the second file to the nginx variable in order to use it later in the server config?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
silverjoe, 2017-05-31
@Ky6uk-Hy6uk

try nginx + lua

B
Boris Korobkov, 2017-05-31
@BorisKorobkov

Nginx parses the file only when include. In other cases, it simply gives the file without analyzing its content.
If you need to dynamically change variables inside Nginx, then you can use $arg_name (from the request) or $sent_http_name (from the response HEADER).
nginx.org/ru/docs/http/ngx_http_core_module.html#v...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question