Skip to content

Instantly share code, notes, and snippets.

@hello-party
Last active August 27, 2022 09:35
Show Gist options
  • Save hello-party/ebaf8a45621de4570c71a94799f5c4f6 to your computer and use it in GitHub Desktop.
Save hello-party/ebaf8a45621de4570c71a94799f5c4f6 to your computer and use it in GitHub Desktop.
How to actually install fancyindex for nginx w/ Ubuntu

This is so stupid. You'll see all of these guides about compiling nginx w/ the module, etc etc -- forget all of that!

sudo apt-get install libnginx-mod-http-fancyindex

DONE. That is it.. at least for the prep. Now you can use

server {
  listen 443 ssl;
  server_name dl.site.name *.dl.site.name;
  index index.html index.php index.htm;
  root /var/www/site.name/dl;
  location / {
    try_files $uri $uri/ =404;
        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;
        fancyindex on;
        fancyindex_exact_size off;
        fancyindex_css_href /assets/style.css;
        fancyindex_ignore assets robots.txt readme.md;
        fancyindex_time_format "%b %y";
        fancyindex_header /assets/header.html;
        fancyindex_footer /assets/footer.html;
        fancyindex_show_path off;
        fancyindex_name_length 40;
  }

I specified the stylesheet location in my header, so you don't really need that here if you're like me. I don't know why these other guides are over-complicating it. There's probably a reason, but I just want to share some shit, man.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment