proxy_max_temp_file_size
The 'proxy_max_temp_file_size' directive sets the maximum size of temporary files used to store proxied responses. — NGINX HTTP Core
Описание
The 'proxy_max_temp_file_size' directive is used to control the maximum size of temporary files that are created while handling responses from proxied servers. If a response exceeds this specified size, NGINX will not store the response in a temporary file and will instead return an error. This is particularly useful to avoid exhausting disk space when handling large responses. The directive can be configured in the http, server, and location contexts for finer control depending on the structure of your server configuration. When configuring 'proxy_max_temp_file_size', you can specify the value in bytes or use suffixes for more readability: 'k' for kilobytes, 'm' for megabytes, and 'g' for gigabytes. It is important to note that setting this value too low might lead to increased errors if certain proxied responses are larger than allowed; conversely, setting it too high may cause storage issues on disk if many large responses are cached temporarily. Hence, it is advisable to evaluate the expected response sizes when defining this limit.
Пример конфига
location /api {
proxy_pass http://backend_server;
proxy_max_temp_file_size 5m;
}Setting the size too small may lead to frequent errors for large responses.
Not considering the disk space when setting a high limit can fill up available storage.