7

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>
1

1 Answer 1

19

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;
}
1

You must log in to answer this question.

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