nginx auth_basic except on specific directory

view full story

http://serverfault.com – I have the following in nginx.conf: server { listen 80; server_name example.com; root /opt/www; index index.html; location = / { auth_basic off; allow all; } location / { auth_basic "Do you even lift?"; auth_basic_user_file htpasswd; autoindex on; } } But it's still giving me 401's when I try to curl to the root directory. What am I doing wrong? (HowTos)