0

I'm trying to do this:

map $request_uri $php_timeout { default 60s; "~^/slow/process/(?:1|two|three)" 120s; } ... fastcgi_read_timeout $php_timeout; 

but nignx -t gives an error:

nginx: [emerg] "fastcgi_read_timeout" directive invalid value in /etc/nginx/...

Is this simply not possible? docs don't say it's not (or that it is).

Nb. if it's not clear, I have several URLs that are best described by a set of regex tests that require different timeouts. I could write separate location blocks for all of these but that gets messy.

3
  • May be you should use another location for slow scripts Commented Jun 6, 2019 at 14:02
  • @AlexeyTen yes it's clear from your answer (thanks!) that I'll have to! Just gets awkward as the slow scripts cross-cut other location definitions. Anyhow, thanks. Commented Jun 6, 2019 at 14:03
  • On the other hand, you could just set 120s for all scripts. Commented Jun 6, 2019 at 14:07

1 Answer 1

1

fastcgi_read_timeout cannot contain variables. Directives that could use variables are marked so.

For example in fastcgi_param:

[…] The value can contain text, variables, and their combination.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.