fancyindex

Styled directory listings with headers and sorting

dynamic moduleBSD-2-Clausesource

Overview

ngx-fancyindex generates directory listings like the built-in autoindex module, but with control over their appearance. Listings can carry custom HTML headers and footers, external stylesheets, and configurable sorting.

It is the usual choice for public download mirrors and file dumps where the plain autoindex output looks too bare. Ready-made themes exist that only need a fancyindex_css_href or header include.

The module is written and maintained by Adrian Perez de Castro and started as a restyled fork of the stock autoindex code.

Key directives

fancyindexTurns fancy directory listings on or off for a location, replacing the autoindex output.
fancyindex_exact_sizeChooses between exact byte counts and human-readable rounded sizes (KB, MB, GB) in the listing.
fancyindex_header / fancyindex_footerInserts a local file or subrequest result before and after the generated listing, which is how themes hook in.
fancyindex_default_sortSets the initial sort order, for example name, size, date, or their descending variants.
fancyindex_localtimeShows file modification times in the server's local time zone instead of GMT.
fancyindex_show_dotfilesControls whether files starting with a dot appear in the listing.

Example

nginx.conf
load_module modules/ngx_http_fancyindex_module.so; server { listen 80; location /files/ { root /srv/www; fancyindex on; fancyindex_exact_size off; fancyindex_localtime on; fancyindex_default_sort date_desc; fancyindex_header /fancyindex/header.html; } }

Availability

Ships as a dynamic module in libnginx-mod-http-fancyindex, installed automatically with nginx-extras. The package drops a load_module config into /etc/nginx/modules-enabled/, so it loads on start.