uwsgi_max_temp_file_size

Sets the maximum size of temporary files when handling uWSGI requests.

Syntaxuwsgi_max_temp_file_size size;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The uwsgi_max_temp_file_size directive in NGINX defines the maximum size that temporary files can take when storing request bodies for uWSGI requests. If this limit is exceeded, NGINX will reject the request with a 413 error (Request Entity Too Large). This is particularly relevant for uploads and can help prevent the server from running out of disk space due to excessively large files being uploaded or processed.

This directive is specified in bytes and can be set in the http, server, or location context, making it flexible for different parts of the configuration. Setting this directive allows administrators to manage disk space more effectively by limiting the size of uploads per location or server block. It’s important to set this value according to the expected file sizes for your application to ensure both performance and reliability.

The typical configuration for this directive will look something like uwsgi_max_temp_file_size 10m;, which would limit temporary files to a maximum of 10 megabytes. In general, it’s good practice to monitor the space used by temporary files on the server and adjust this setting as needed based on application usage patterns.

Config Example

location /upload {
    uwsgi_pass 127.0.0.1:9000;
    uwsgi_max_temp_file_size 10m;
}

Setting this value too low may lead to unexpected 413 errors for legitimate uploads.

Not all clients handle 413 errors gracefully; ensure client applications can manage these responses.

← Back to all directives