concat_max_files

Sets the maximum number of files that can be concatenated in a single request for the NGINX HTTP Concatenation module.

Syntaxconcat_max_files number;
Default10
Contexthttp, server, location
Arguments1

Description

The concat_max_files directive in the NGINX HTTP Concatenation module specifies the upper limit on the number of files that can be concatenated into a single response. This directive is particularly useful when optimizing web performance by reducing HTTP requests, as it allows multiple resources to be combined into one. The parameter takes a single argument, which is a number that indicates the maximum allowable files for concatenation. If the number of requested files exceeds this limit, the server will return an error.

This directive can be set in various contexts, including http, server, and location, allowing fine-grained control over where it applies. By default, the limit is set to 10 files, which means any attempt to concatenate more than this will result in a response indicating the exceeding of the maximum files limit. Users can change this value to suit their requirements, such as setting higher limits for less frequently accessed resources or lower limits for more commonly accessed ones to prevent overload.

It is important for users to be aware of potential issues with large requests. On systems like Linux, a single URI cannot exceed the default page size (usually 4KB), and if users attempt to concatenate too many files and exceed this limit, they may encounter errors. In such cases, the large_client_header_buffers directive can be utilized to adjust buffer sizes accordingly.

Config Example

location /static/css/ {
    concat on;
    concat_max_files 20;
}

Setting this directive too high can lead to performance issues and exceed system limits.

Make sure to adjust large_client_header_buffers if you're concatenating a large number of files to avoid request errors.

← Back to all directives