Module ngx_http_auth_basic_module

ngx_http_auth_basic_module模块允许通过使用“ HTTP 基本认证”协议验证用户名和密码来限制对资源的访问。

也可以通过address子请求的结果JWT来限制访问。 satisfy指令控制通过地址和密码同时访问的限制。

Example Configuration

location / {
    auth_basic           "closed site";
    auth_basic_user_file conf/htpasswd;
}

Directives

Syntax: auth_basic string | off;
Default: auth_basic off;
Context: http , server , location , limit_except

使用“ HTTP 基本身份验证”协议启用用户名和密码的验证。指定的参数用作realm。参数值可以包含变量(1.3.10、1.2.7)。特殊值off可以取消从先前配置级别继承的auth_basic指令的效果。

Syntax: auth_basic_user_file file;
Default:
Context: http , server , location , limit_except

以以下格式指定保留用户名和密码的文件:

# comment
name1:password1
name2:password2:comment
name3:password3

file名称可以包含变量。

支持以下密码类型:

Note

添加对SHA方案的支持仅是为了帮助从其他 Web 服务器迁移。不应将其用于新密码,因为它采用的未加盐 SHA-1 哈希很容易受到rainbow table攻击。

首页