Blog |Follow Nick on Mastodon| About
 

Following the sucess of my apache styling post, I thought I'd share how I've styled /files now that linickx.com is powerd by nginx.

A quick google will tell you that fancyindex is on option however, I'm running CentOS and the supplied rpm doesn't come with that moduel.... and I'm not about to start compiling!

What I did find is that the rpm comes with is, http_addition_module. It's not a perfect solution for applying HTML/CSS to autoindex because the output ends up with two lots of html & body tags... anyway onto the example!

In my nginx config, I've added:

location /files {
  add_before_body /files/nginx-before.txt;
  add_after_body /files/nginx-after.txt;
  autoindex on;
}

autoindex enables directory listings; the two text files, nginx-before.txt & nginx-after.txt apply the style.

You can view my example files here:

Here's a couple of screenshots:

nginx autoindex before   nginx autoindex before
Before   After

Enjoy!

 

 
Nick Bettison ©