zoukankan      html  css  js  c++  java
  • 配置nginx身份验证(ngx_http_auth_basic_module)

    编译的时候默认参数即可

    ./configure --with-pcre=../pcre --with-zlib=../zlib --with-http_ssl_module --with-openssl=../openssl --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_flv_module --with-debug

    修改配置文件

    location / {
                root   
    /usr/local/nginx/html;
                    auth_basic 
    "Auth";
                     auth_basic_user_file 
    /usr/local/nginx/conf/htpasswd; 
                index  index.html index.htm;
    }

    auth_basic "Auth"中的Auth是弹出框(输入用户名和密码)的标题

    auth_basic_user_file /usr/local/nginx/conf/htpasswd; 中的/usr/local/nginx/conf/htpasswd是保存密码的文件

    密码文件生成,需要apt-get install mini-httpd

    htpasswd -/usr/local/nginx/conf/htpasswd 用户名

    配置好后,重启,应该就可以了。

    注:我在配置的时候,由于IE9缓存数据,造成不弹出身份验证框。清楚缓存就好了。 

  • 相关阅读:
    迭代器模式
    命令模式
    模板方法
    springmvc执行原理及自定义mvc框架
    代理模式
    外观模式
    组合模式
    装饰器模式
    02——Solr学习之Solr安装与配置(linux上的安装)
    01——Solr学习之全文检索服务系统的基础认识
  • 原文地址:https://www.cnblogs.com/xewnwsl2001/p/1905648.html
Copyright © 2011-2022 走看看