2012年10月

  • 睡五分钟等于六钟头的方法(熬夜必看)

    2012-10-21 07:29:55 28083 0 生活随笔
    • Nginx 使用 htpasswd 生成密码认证

      2012-10-08 10:26:58 27556 0 技术文章

      安装 httpd-tools

      yum install -y httpd-tools
      

      htpasswd 命令需要先安装 httpd-tools

      修改 nginx.conf

      # xxx.cuiliang.com
      server {
          listen       80;
          server_name  xxx.cuiliang.com;
          auth_basic "密码提示语";
          auth_basic_user_file /usr/local/nginx/conf/htpasswd.users;
      
          location / {
              //...
          }
      }
      

      使用 htpasswd 生成密码

      htpasswd -b /usr/local/nginx/conf/htpasswd.users
      

      输入密码,再次确认密码,提示成功,OK!

      重启 nginx

      /usr/local/nginx/sbin/nginx -s reload
      

      重启生效