nginx中的验证模块

nginx中使用验证模块:

   例:location / {

     auth_basic "Restricted";

     auth_basic_user_file /usr/local/awstats/auth/passwd.nginx;

     }

  这里的passwd.nginx需要拿命令产生,因为nginx只接受经过加密的验证密码,接受的验证方法有三种:crytp、apr1(apache MD5)、MD5

  在上面的文件目录下,使用命令:(以下john为帐号,后面的12345为密码)

printf "John:$(openssl passwd -crypt 12345)\n" >> .htpasswd   
printf "John:$(openssl passwd -apr1 12345)\n" >> .htpasswd
printf "John:$(openssl passwd -1 12345)\n" >> .htpasswd
原文地址:https://www.cnblogs.com/agostop/p/2426535.html