Is there a way to define your own autoindex pages in nginx?
I want to add my own HTML and CSS to the generated autoindex pages.
Is there a way to define your own autoindex pages in nginx?
I want to add my own HTML and CSS to the generated autoindex pages.
Using XSLT is possible to customize autoindex's xml output using the xslt module:
It's what I did on this project: ngx-superbindex
Same answer as gibatronic: harness the power of xslt! Have a look at this sample xslt file:
What I particularly like is the ability to sort by date, defined here with:
<xsl:sort select="@mtime"/>
It certainly requires more effort to setup compared to adding a couple of directives in a .htaccess file. And, xml files are cumbersome to write and read. However, the customization potential is great and very nice to have!
See an introductory tutorial on w3schools.
turns out you can add valid html with the http addition module.
i don't claim to understand it fully, but there's a repository that does exactly what you want, so you can try and go from there.
Edit (2019):
After looking into it, this is actually a rather simple task.
.assets
, so autoindex won't display it.add_after_body /.assets/my_html_file.html
to your nginx rules. ta-da!Note that, according to the docs, this module is not part of a default compilation. I found that the nginx package on ubuntu has it, though.
The existence of the Fancy Index module would suggest that the built-in autoindex module has no customisation ability. I'm not sure if I'd recommend the fancy index module, though -- it doesn't look like it's particularly up-to-date (last edited 2007...)
You could also try h5ai:
http://larsjung.de/h5ai/
They provide a really nice interface for browsing the files.