auth_basic_user_file
auth_basic_user_file指令,用于设置包含用户名和密码信息的文件路径,语法结构为:
auth_basic_user_file file;
其中,file为密码文件的绝对路径。这里的密码文件支持明文或者密码加密后的文件。
明文的格式如下所示:
name1:password1 name2:password2:comment name3:password3
加密密码可以使用crypt()函数进行密码加密的格式,在Linux平台上可以使用htpasswd命令生成。
# htpasswd -c -d /nginx/conf/pass_file username
Last updated
Was this helpful?