scgi_read_timeout
Sets the timeout for reading the response from an SCGI server.
Description
The scgi_read_timeout directive defines a timeout for reading the response from an SCGI (Simplified Common Gateway Interface) server. This directive helps to avoid hanging connections when the backend SCGI server is slow to respond or becomes unresponsive, ensuring that resources are freed up if the server does not send data within a specified time frame. The timeout period can be specified as a time in seconds, or with a m or h suffix, specifying minutes or hours respectively.
When this timeout is exceeded, NGINX will terminate the connection to the SCGI server and return an error to the client. This is particularly useful in high-performance web applications where maintaining responsiveness and limiting resource usage are critical. By configuring this directive appropriately, you can balance between allowing sufficient processing time for the SCGI server and minimizing request latency for end users.
Config Example
location /scgi {
include fastcgi_params;
scgi_pass 127.0.0.1:9000;
scgi_read_timeout 30s;
}Specifying a value that is too low may cause valid requests to fail if the SCGI server takes time to respond.
Make sure the timeout doesn't exceed the overall request timeout settings to avoid inconsistent behavior.
The time format must be correctly specified, e.g., '30s' for 30 seconds.