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; }