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.

  • May be you should use another location for slow scripts – Alexey Ten Jun 6 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. – artfulrobot Jun 6 at 14:03
  • On the other hand, you could just set 120s for all scripts. – Alexey Ten Jun 6 at 14:07
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.