1. 修改/usr/local/apache/conf/vhost/0.conf
AllowOverride AuthConfig
2. 确保动态库打开 authz-core和authn-core
3. 设置用户名和密码
mkdir /usr/local/apache/passwd
htpasswd –c /usr/local/apache/passwd/passwords build # build 为用户名
提示输入密码
4. 在服务目录下新建.htaccess 配置如下
AuthType Basic
AuthName "Restricted Files"
# (Following line optional)
AuthBasicProvider file
AuthUserFile "/usr/local/apache/passwd/passwords"
Require user build
5. 资料链接