uwsgi_connect_timeout

Sets the timeout for connecting to a uWSGI server in NGINX.

Syntaxuwsgi_connect_timeout time;
Default60s
Contexthttp, server, location
Arguments1

Description

The uwsgi_connect_timeout directive specifies the duration that NGINX will wait for a successful connection to a uWSGI server. If the specified timeout elapses before establishing a connection, NGINX will terminate the attempt and return an error. This parameter is crucial when interacting with uWSGI applications, especially in environments where latency or server unavailability might lead to prolonged connection attempts. The value of this directive is defined in seconds and accepts either an integer for the number of seconds or a time format such as '30s' for 30 seconds. It can be configured at the http, server, or location context, thus allowing for centralized or granular configuration settings based on different application needs.

Misconfigurations around uwsgi_connect_timeout can lead to subtle issues, like slow responses or undesirable timeouts, which can impact the user experience. Administrators must ensure that their settings align with their application's performance requirements and expected load scenarios. The usage of this directive should be appropriately documented to ensure that subsequent adjustments can be made based on operational feedback, particularly in high-traffic applications.

Config Example

http {
    server {
        location / {
            uwsgi_pass 127.0.0.1:9000;
            uwsgi_connect_timeout 30s;
        }
    }
}

Setting a timeout that is too short may result in failed requests in high-latency environments.

Configuring a long timeout in a low-load application may result in unnecessary resource consumption during connection attempts.

← Back to all directives