Nginx身份验证

 

Nginx身份验证
nginxstatus做身份验证:
#cd /usr/local/nginx/conf
#mkdir htpasswd
/usr/local/apache2/bin/htpasswd -c /usr/local/nginx/conf/htpasswd/zhang zhang #添加用户名为zhang
New password:   (此处输入你的密码)
Re-type new password:   (再次输入你的密码)
Adding password for user
配置nginx
location ~ ^/(zhang)/  {
                root    /htdocs/count;
                        auth_basic              "LT-COUNT-TongJi";
                        auth_basic_user_file  /usr/local/nginx/conf/htpasswd/zhang;
                }
看看打开页面是否需要输入用户名和密码!

 


你可能感兴趣的:(nginx,职场,休闲,Nginx身份验证)