client_body_temp_path

The `client_body_temp_path` directive sets the file system path for temporary files related to client request bodies.

Syntaxclient_body_temp_path path [max_size [max_files [timeout]]];
Defaultnone
Contexthttp, server, location
Arguments1-4

Description

The client_body_temp_path directive specifies where the temporary files containing the client body data will be stored during the processing of incoming requests. This directive is particularly relevant when handling larger request bodies, typical in file uploads. It can take a single path as an argument or optionally up to four parameters: the path to store the files, the maximum size of each temporary file, the maximum number of temporary files to be created, and an optional timeout value for deleting temporary files after a specified duration. Proper configuration of this directive is crucial for optimizing file upload processes and managing disk usage effectively.

The path specified should be writable by the user under which the NGINX worker processes run. Additionally, when multiple parameters are provided, they must be specified in the order defined in the documentation. If only a single path is specified, it defaults to a set location like /tmp on Unix-like systems. It's also important to ensure that the specified directory exists and is properly secured to avoid any potential security vulnerabilities.

Config Example

client_body_temp_path /var/tmp/nginx/client_body_temp;

Ensure the specified directory exists and is writable by the NGINX user.

Be cautious of disk space when accepting large client body uploads, to avoid filling up the filesystem.

Avoid overly restrictive permissions on the temp directory to prevent write failures.

← Back to all directives