6

in apache i could have a Satisfy Any directive, allowing access without password from a specified IP.

how to do with nginx?

<Directory /home/www/site1/private>
  AuthUserFile /home/www/site1-passwd
  AuthType Basic
  AuthName MySite
  Require valid-user
  Order allow,deny
  Allow from 172.17.10
  Satisfy any
</Directory>
17

Easy:

location / {
    root /home/www/site1/private;
    satisfy  any;
    allow  172.17.10.0/24;
    deny   all;

    auth_basic            "MySite";
    auth_basic_user_file  /home/www/site1-passwd;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.