Apache增加Basic Auth

在.htaccess文件中增加
AuthUserFile /var/www/htpasswd/test.htpasswd
AuthName EnterPassword
AuthType Basic
require valid-user

#htpasswd密码文件生成。Create a password file Filename with username as the initial ID. It will prompt for the password
htpasswd -c Filename username

#Add or modify username2 in the password file Filename
htpasswd Filename username2
http://httpd.apache.org/docs/2.2/en/mod/mod_authn_file.html

#HTTP中传过去的Base Authentication是用base64编码的“user:pass” [1]


#生成md5加密的basic auth
htpasswd -cmb test.txt test 123456

#将生成的用户名和密码打印到控制台
htpasswd -nmb test 123456

posted on 2016-04-10 06:27  dream_bccb  阅读(421)  评论(0)    收藏  举报