Nginx protect directory with password, except for specific ip's
In my Nginx setup I would like to password protect some website, except when I access it from my ip at home. How do I set this up?
Also, except for getting access to my home pc, is this safe?
Solution 1:
After long searching I found it myself.
When satisfy_any is put on "Directive solves access with at least one successful checking, executed by modules HttpAccessModule or HttpAuthBasicModule"
location / {
satisfy any;
allow 10.1.1.10;
deny all;
auth_basic "closed site";
auth_basic_user_file /data/www_data/htpasswd;
}
(satisfy any
is the new syntax, satisfy_any
threw a warning. The documentation I can't find however)