首页 > Web开发 > 详细

简单的实现HTTP密码验证登陆

时间:2019-03-07 19:38:29      阅读:194      评论:0      收藏:0      [点我收藏+]

1.首先需要安装 httpd-tools

yum install -y httpd-tools

 

2.安装完成后设置用户名密码,我这里用的是NGINX  

   htpasswd -bc /mypath/nginx/conf/htpasswd.users admin(注:用户名) 123456(注:密码)

3. 修改nginx的配置:


server {
        listen       80;
        server_name  elk.log.com;

        #charset koi8-r;
        #access_log  logs/host.access.log  main;

       auth_basic "Restricted Access";
       auth_basic_user_file /mypath/nginx/conf/htpasswd.users;      #登录验证
       location / {

           proxy_pass http://127.0.0.1:5601;     #转发到你指定的域名或IP
           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection ‘upgrade‘;
           proxy_set_header Host $host;
           proxy_cache_bypass $http_upgrade;
           allow 192.168.0.1;  #允许的IP
           allow 118.133.10.6; #允许的IP
           deny all;
       }
}

 

简单的实现HTTP密码验证登陆

原文:https://www.cnblogs.com/lhlucky/p/10491469.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!