美文网首页
nginx启动HTTP Basic Authentication

nginx启动HTTP Basic Authentication

作者: 小黑佬 | 来源:发表于2019-12-19 17:21 被阅读0次

    这个比较简单了!!使用apache2 的httpd-tools工具写一个http password ,然后加载一下配置就好了。

    yum install httpd-tools -y
    mkdir -p /etc/apache2
    #初次创建需要-c 
    htpasswd -c /etc/apache2/.htpasswd centosvmuser01
    输入两次密码
    htpasswd  /etc/apache2/.htpasswd centosvmuser02
    输入两次密码
    htpasswd  /etc/apache2/.htpasswd centosvmuser03
    输入两次密码
    

    使用例子:

    location /api {
        auth_basic           “Administrator’s Area”;
        auth_basic_user_file /etc/apache2/.htpasswd; 
    }
          
    
    HTTP Basic Authentication.png

    相关文章

      网友评论

          本文标题:nginx启动HTTP Basic Authentication

          本文链接:https://www.haomeiwen.com/subject/pwqvnctx.html