2

The location block I'm using to statically serve files is:

location ~ ^/git/?(.*)$ {
    root /home/aoeu/git-webserver;
    autoindex on;
    try_files /$1 /$1/ 404;
}

which is mostly working, except that files and directories inside of the /home/aoeu/git-webserver directory that begin with a . character are not included in the directory listing that nginx returns when I visit the /git/ path of by website. Same for their respective subdirectories.

I can manually enter a dot-prefixed directory into my browser URL bar and browse it (which seems like a pretty awkward inconsistency and a possible security issue with nginx). I just cannot see it to click on it while I am browsing its parent directory.

I would like all files to be visible, no matter what character they start with.

2 Answers 2

0

According to this reddit thread that functionality is missing. The thread links to ticket 557 from 2014, which has a patch to add a configuration option allowing dot files to be listed. Yet the ticket is open, and a quick look at the source code shows that ngx_http_autoindex_handler() simply continue:s whenever encountering an entry starting with a dot, still some eight-nine years later.

It is likely possible to apply the patch from the trac ticket, with or without some extra work required to adapt it to the contemporary code base.

I went with giving up on nginx for this and replaced it with lighttpd instead.

# lighttpd config showing dot files in directory listings.
dir-listing.activate = "enable"
dir-listing.hide-dotfiles = "false"
0

it is now possible to use fancyindex module to show dot/hidden files

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .