0

Nginx 开启 auth_basic 认证, 使用用户名密码访问

neo created at6 years ago view count: 2661

ngx_http_auth_basic_module 模块允许设置用户名和密码访问指定资源。

    location /test{
        auth_basic         on;
        auth_basic_user_file /root/.htpasswd; #绝对路径
    }

/root/.htpasswd 的内容可以通过以下命令生成。

htpasswd -nbB myName myPassword 

或者通过下面的网址生成。 http://www.awesometool.org/Generate/Htpasswd

report
回复

Recent search keywords