Location directive.
location / { satisfy any; allow 10.10.10.1; deny all; auth_basic "basic authentication"; auth_basic_user_file /www/.htpasswd; }