scgi_send_timeout

The 'scgi_send_timeout' directive sets the maximum time that NGINX will wait while sending a request to a SCGI server.

Syntaxscgi_send_timeout time;
Default60s
Contexthttp, server, location
Arguments1

Description

The 'scgi_send_timeout' directive specifies the time limit for sending a request to a SCGI (Simple Common Gateway Interface) server. This timeout is crucial in scenarios where NGINX serves as a reverse proxy to SCGI backends. If the specified time limit is exceeded, NGINX will close the connection to the SCGI server, effectively terminating the request. The timeout is measured from the moment NGINX starts sending data until it successfully sends all the requested data, making it essential for handling long-running requests or responses that might stall.

This directive can be defined in the 'http', 'server', or 'location' contexts, allowing for flexibility in configuring timeout policies at different granularity levels within the server configuration. The parameter taken by this directive is a time value, which can be expressed in various formats including seconds, minutes, or a combination, using suffixes like 's', 'm', etc. Administrators can configure this directive to safeguard against unresponsive SCGI servers, optimizing resource use by preventing NGINX from waiting indefinitely for a response that may not arrive.

Users should be cautious when setting the timeout value too low, as it may lead to premature disconnections for valid, long-running requests. Conversely, setting it too high might lead to unnecessary resource consumption. It is advisable to consider the nature of application load and SCGI server performance when determining an appropriate timeout value.

Config Example

location /api {
    scgi_pass backend;
    scgi_send_timeout 30s;
}

Using a timeout value too low may cause valid requests to fail prematurely.

Ensure the timeout setting aligns with the expected response time of the SCGI server.

← Back to all directives