Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show only some files in directory listing with NGINX

Tags:

nginx

I finally figured out how to show a directory listing of a folder using nginx. The problem is that it shows every file and directory in that folder. Is it possible to filter the results? Like show only files with a specific extension or something like that? Thanks

like image 419
snakethesniper Avatar asked Dec 13 '17 09:12

snakethesniper


1 Answers

No, the auto-index feature does not support filtering. But you can change permissions of the files to not be visible/served, but that only works if you dont want them accessible at all.

You could try to manually modify the body response with sub_module using regexp that matches files to hide.

like image 189
Eddie Avatar answered Oct 25 '22 08:10

Eddie