目录验证

nginx目录验证

建立一个密码文件,然后设置nginx设置

bear@njava:/$ sudo mkdir /etc/nginx/conf
bear@njava:/$ sudo htpasswd -c /etc/nginx/conf/passwd njava
bear@njava:/$ sudo vi /etc/nginx/sites-available/njava
location ~ ^/xxx/  {
      root    /data/htdocs/xxx;
      auth_basic              "input your username and password";
      auth_basic_user_file /etc/nginx/conf/passwd;
}

Tags: ,

星期日, 28 3 月, 2010 服务器 没有评论
1LMooBmUE153Wnd3zDryWvDyXxQudbFxDr