Apache增加Basic Auth

时间:2021-12-11 16:52:51
在.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