autoindex_exact_size
The `autoindex_exact_size` directive controls whether the exact file size is displayed in the directory listing generated by the autoindex module.
Description
The autoindex_exact_size directive is used within the NGINX HTTP server to determine how file sizes are presented in auto-generated directory listings. When this directive is enabled (set to 'on'), NGINX will display the exact sizes of files in bytes. If set to 'off', it will convert the size to a more human-readable format (like KB, MB, etc.) when providing directory listings. This setting can be particularly useful for users who require precise data about file sizes, especially in environments where file sizes need to be monitored closely.
The context for this directive includes http, server, and location, allowing for flexible placement depending on the application's architecture. The directive accepts a single flag argument: it can be either 'on', or 'off'. The presence of these options allows the server administrator to customize the behavior of autoindexing based on the needs of specific server locations or the entire server configuration.
Config Example
location /files {
autoindex on;
autoindex_exact_size on;
}Ensure that the autoindex module is enabled, otherwise this directive will not take effect.
Misuse of this directive in combination with other autoindex directives can lead to confusing output.
Setting this directive to 'on' can significantly increase the size of directory listings, making them harder to read.