Nginx Uwsgi Configuration

If you plan to allow users / staff to download OS images you must configure the uwsgi_max_temp_file_size directive accordingly to your needs.

The default value for uwsgi_max_temp_file_size directive is set to 1GB and you must increase it if you know that you will have images bigger than this value.

In order to increase that value, you will have to add the directive in /etc/nginx/uwsgi_params

Syntax:     uwsgi_max_temp_file_size size;
Default: uwsgi_max_temp_file_size 1024m;

The way that download works is that if the whole response does not fit into the buffers set by the uwsgi_buffer_size and uwsgi_buffers directives (uwsgi_buffering is on by default), a part of the response can be saved to a temporary file. The uwsgi_max_temp_file_size directive sets the maximum size of that temporary file.

The size of data written to the temporary file at a time is set by the uwsgi_temp_file_write_size directive.

Syntax:     uwsgi_temp_file_write_size size;
Default: uwsgi_temp_file_write_size 8k|16k;

There are more customizations for this (like buffering size, caching, temporary file path, etc.), using the ngx_http_uwsgi_module but we don’t recommend changing the configuration only if you’re an advanced nginx user.

If temporary file saving of response from uwsgi to nginx is enabled make sure you have enough storage space avaiable and that you monitor free storage space.