I think fastcgi_read_timeout
is what I need here, but would like to get expert confirmation on my use-case! Thanks.
--
I have nginx doing fastcgi relay to a php-fpm instance.
The fpm instance, from time to time needs to be restarted. This can take upwards of 1 to 2 seconds. If a request comes in during this time, nginx will give the user a 502 error.
Ideally we will have a cluster of fpm processes for rolling restarts, but that's out of scope at this time.
My goal is to have NGINX wait, up to X s/ms before returning a 502 to the user if the cgi-relay is not available.
Here is a general idea of what I'm working with:
location ~ ^/path/to(/|$) {
include includes/php.conf;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SERVER_NAME $host;
fastcgi_param REQUEST_SCHEME $http_x_forwarded_proto;
# Assume some timeout param can be added here??
fastcgi_pass php-fpm:9000;
}