> Auth does not work in the scope of if, what else can I do? Thanks. You are missing 'satisfy any;' Try this: location / { satisfy any; allow 192.1.1.1; auth_basic "Restricted"; auth_basic_user_file /usr/local/nginx/conf/htpasswd; deny all; } -- rr