Ahoj, 
prepisujem config z apacha pre nginx a dostal som sa do problému s týmto blokom:
<Directory "/var/www/html/d">
   AllowOverride All
   AuthUserFile  /etc/httpd/.htpasswd
   AuthType Basic
   AuthName "dockdrop"
   Require valid-user
   #Options None +Indexes
   Options All +Indexes
      <Files ?*>
         Order allow,deny
          Allow from all
          Satisfy any
       </Files>
</Directory>
Systém sa chová tak, že obsluhuje requesty na existujúce súbory, pokus o 'prehliadanie' sa musí najpv authentifikovať.
Čiže
www.example.com/ [AUTH]
www.example.com/file.txt  [OK]
www.example.com/obrazky  [AUTH]
www.example.com/obrazky/obrazok1.jpg  [OK]
www.example.com/obrazky/subfolder [AUTH]
Zatiaľ som sa dopracoval k niečomu takému, ale nefunguje to podľa predstáv...
 location / {
   try_files $uri $uri/ =404;
   auth_basic "Restricted Content";
   auth_basic_user_file /etc/nginx/.htpasswd;
   autoindex on;
   location ~* /(.+) {
      auth_basic off;
   }
}