nginx 访问加密码保护

nginx配置文件中加入

  location / {
    root   html;
    index  index.html index.htm index index.jpg;
    auth_basic 'Restricted';
    auth_basic_user_file htpasswd;
  }

yum install httpd 目的是要htpasswd 这个工具
为user设置密码:
htpasswd -c /usr/local/nginx/conf/htpasswd user

滚动至顶部