ngx_http_auth_basic_module
You can use this module to protect your site or parts of it with username and password based on HTTP Basic Authentication.
Example configuration
location / {
auth_basic "Restricted";
auth_basic_user_file conf/htpasswd;
}
Directives
auth_basic
syntax: auth_basic [ text|off ]
default: auth_basic off
context: http, server, location, limit_except
This directive includes testing name and password with HTTP Basic Authentication. The assigned parameter is used as authentication realm. A value of "off" makes it possible to override the action for the inheritable from a lower-level directive.
auth_basic_user_file
syntax: auth_basic_user_file the_file
default: no
context: http, server, location, limit_except
This directive sets the htpasswd filename for the authentication realm. Since version 0.6.7 the filename path is relative to directory of nginx configuration file nginx.conf, but not to nginx prefix directory.
The format of file is the following:
# the comment user:pass user2:pass2:comment user3:pass3
Passwords must be encoded by function crypt(3). You can create the password file with the htpasswd program from Apache.
