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