fancyindex_header

The `fancyindex_header` directive allows customization of the header in directory listings generated by the NGINX Fancy Index module.

Syntaxfancyindex_header string | file;
Defaultnone
Contexthttp, server, location
Arguments1-2

Description

The fancyindex_header directive is designed to customize the appearance of directory listings when using the NGINX Fancy Index module. By default, this module provides a visually enhanced representation of directory contents compared to NGINX's native autoindex feature. With the fancyindex_header directive, users can specify a custom header either directly as a string value or by referring to a local file path that contains the header content, allowing for greater flexibility in how directory pages are presented to users.

This directive can accept one to two arguments. The first argument is mandatory and specifies the header content, while the optional second argument allows for an alternative method of including the header, such as pointing to a specific file. When no custom header is provided, the module will generate a default header for the generated index page, ensuring that there is always a visible header when a directory listing is displayed. This directive, as part of a broader customization framework, can significantly enhance user experience by allowing more control over the look and feel of directory listings.

Config Example

location /files {
    fancyindex on;
    fancyindex_header '

Welcome to the Files Directory

'; fancyindex_footer '/path/to/footer.html'; }

Ensure that specified files for headers are accessible to the NGINX process; otherwise, errors may occur.

Using remote files for headers is not supported; paths must be local. Ensure the correct file paths are provided.

← Back to all directives