在httpd.conf写入
vi httpd.conf
<Directory "/data/www/mrtg">
AuthType Basic #注意一点,Basic认证方法并不加密来自用户浏览器的密码
AuthName "mrtg access"
AuthUserFile /data/apache2/passwd/htpasswd #密码文件,也就是htpasswd
建立的文件
Options Indexes FollowSymLinks
AllowOverride AuthConfig
Order allow,deny
Allow from all
Require valid-user
</Directory>
执行命令建立密码文件
htpasswd -c /data/apache2/passwd/htpasswd username
重新启动apache即可
apache认证访问
最新推荐文章于 2022-11-24 22:12:09 发布