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: ,

星期日, 三月 28th, 2010 服务器

Leave a Reply

1LMooBmUE153Wnd3zDryWvDyXxQudbFxDr