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