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;
                }
看看打開頁面是否需要輸入用戶名和密碼!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章