zoukankan      html  css  js  c++  java
  • (二)ngxin设置用户认证

    vim /usr/local/nginx/conf/vhost/test.com.conf           #添加一个虚拟主机配置文件

    添加下面内容

    server {
    listen 80;
    server_name test.com;
    index index.html index.htm index.php;
    root /data/wwwroot/test.com;

    location /admin/                #这里/指定的全部 ~指定单个文件
    {
    auth_basic "Auth";
    auth_basic_user_file /usr/local/ngxin/conf/htpasswd;

    autoindex on;

            #定义的用户名密码文件,这里需要用htpasswd

    }

    }

    yum -y isntall httpd   #安装http

    htpasswd -c /usr/local/nginx/conf/htpasswd aaa             #设置一个用户为aaa  -c只要指定一次就好,如果需要在添加多个用户 不需要指定,这里-c指覆盖
    New password:                          #密码bbb
    Re-type new password:   
    Adding password for user aaa

    /usr/local/nginx/sbin/nginx -s reload   #重新加载

  • 相关阅读:
    sublime there are no packages for installation
    linux 安装php扩展mbstring
    生成器表达式和列表推导式
    send()和next()
    迭代器生成器
    装饰器
    函数随笔
    Django进阶
    数据结构与算法入门
    MySQL必会
  • 原文地址:https://www.cnblogs.com/lh777/p/8051631.html
Copyright © 2011-2022 走看看