http://nginx.org/en/docs/http/ngx_http_core_module.html#satisfy
syntax: satisfy all | any;
default:
satisfy all;
context: http, server, location
Allows access if all (all) or at least one (any) of the ngx_http_access_module, ngx_http_auth_basic_module or ngx_http_auth_request_module modules allow access.
因此,就只需在特定的 location 中,加上上述敘述即可:
location ^~ /service/ {
satisfy any;
# ngx_http_access_module
allow 127.0.0.1/32;
deny all;
# ngx_http_auth_basic_module
auth_basic "Restricted Area";
auth_basic_user_file htpasswd;
# …
}
沒有留言:
張貼留言