apache认证访问

来源:互联网 发布:成品油批发价年度数据 编辑:程序博客网 时间:2024/05/16 06:30

在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即可

原创粉丝点击