Heim > Artikel > Backend-Entwicklung > nginx增添php basic验证
nginx添加php basic验证
几种方式:
1.命令 http://www.centos.bz/2011/12/nginx-http-auth-basic/
如果没有apache的htpasswd程序,可以使用pl程序生成:
程序地址:http://trac.edgewall.org/export/10890/trunk/contrib/htpasswd.py
使用方法: ./htpasswd.py -b -c pass.txt admin 123456
pass.txt为密码文件,admin是用户名,123456是密码.
2.apache http://jooben.blog.51cto.com/253727/429977
3.命令生成密码
./pw.pl password
生成好之后,在nginx中添加
#auth_basic "Please input your username and password!";
#auth_basic_user_file /usr/local/nginx/conf/engir_pass;