scgi_temp_file_write_size

Sets the size limit for temporary files created during SCGI requests.

Syntaxscgi_temp_file_write_size size;
Default64k;
Contexthttp, server, location
Arguments1

Description

The scgi_temp_file_write_size directive specifies the maximum size of temporary files that are created for storing data when processing SCGI (Scripting Common Gateway Interface) requests. This directive is particularly relevant for handling large response bodies or when responses require chunked transfer encoding, as it can affect how data is buffered and written to temporary files. Setting this directive allows administrators to control disk space usage and performance implications due to excessive temporary file sizes.

When the size of the SCGI response exceeds the specified limit, NGINX will utilize temporary files to handle the additional data. The configured size should be carefully chosen based on expected response sizes and available resources to prevent performance degradation or out-of-disk-space errors. Additionally, if the directive is set to a very high value, it may lead to longer write times if temporary storage becomes a bottleneck, while setting it too low could lead to increased frequency of disk I/O operations if responses are split into smaller writes.

This directive can be included in different contexts such as http, server, or location, allowing for granular control of temporary file size across different parts of the application as needed. Understanding the specific use case and adjusting the value accordingly is key to optimizing performance and resource usage in SCGI handling.

Config Example

http {
    scgi_temp_file_write_size 128k;
}

Setting this too low may lead to performance issues due to increased frequency of disk writes.

Not supported in every context; using it outside of an appropriate block can lead to configuration errors.

← Back to all directives