1.配置文件
<VirtualHost *:80>
。。。
<Directory “/home/wwwroot/default/xxx”>
Options Indexes FollowSymLinks
AllowOverRide AuthConfig
AuthType Basic
AuthName “Auth”
AuthUserFile “/usr/local/apache/conf/vhost/userfile”
Require valid-user
</Directory>
。。。
</VirtualHost>
2.生成密码文件(如果未安装htppasswd,执行安装apt install apache2-utils)
htpasswd -c -m /usr/local/apache/conf/vhost/userfile reacherbase