1.编辑httpd.conf
Alias /wiki "/var/www/html/hdwiki"
<Directory "/var/www/html/hdwiki">
Options Indexes MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
2. 创建.htaccess文件
vi /var/www/html/hdwiki/.htaccess
AuthName "wiki web"
AuthType Basic
AuthUserFile /var/www/html/hdwiki/.htpasswd
require valid-user
3.就是创建apache的验证用户
htpasswd -c /var/www/test/.htpasswd wiki
如果你们想修改密码,可以如下
htpasswd -m .htpasswd frank
4.重启apache服务
转载于:https://blog.51cto.com/xiaotanglinux/460670