untar_archive
The `untar_archive` directive specifies the tar archive to be accessed for serving content within NGINX.
Description
The untar_archive directive is part of the NGINX HTTP Untar Module, which allows users to serve static file content from tar archives directly. By using this directive, you specify the name of the tar archive that NGINX will reference when responding to requests for files contained within that archive. This directive supports various contexts, including http, server, and location, effectively enabling granular control over how archived content is accessed based on server configuration.
When the untar_archive directive is called, it expects a single string argument that denotes the path to the tar archive. The module leverages zero-copy techniques to serve files directly from the archive without creating temporary files on disk, which boosts performance and minimizes latency for file delivery. The corresponding untar_file directive should be employed to specify the individual file to extract and serve from the mentioned archive. The interaction between these directives allows for a seamless integration of archived content into the NGINX serving process, reducing the overhead typically associated with file retrieval from compressed or archived sources.
One key aspect of using the untar_archive directive is its compatibility with caching mechanisms that enhance performance by reducing the need for repeated scans of the archive during file requests. However, as this module currently only supports basic tar format operations, certain limitations exist, such as lack of support for listing archive entries or handling more complex tar features like symlinks. Hence, while providing efficient access to static content, users should carefully consider these constraints when designing their configurations.
Config Example
location ~ ^/(.+?\.tar)/(.*)$ {
untar_archive "$document_root/$1";
untar_file "$2";
untar;
}Ensure the specified tar archive is accessible and readable by NGINX user.
Valid paths should not include accidental trailing slashes that could lead to misinterpretation of filenames.
This module does not support complex tar features like symbolic links or entries listing, which can lead to unexpected behavior.