apache配置http basic auth


参考:http://httpd.apache.org/docs/2.0/howto/auth.html

 

1.使用apache自带的htpasswd创建密码文件;

# htpasswd -c /home/lai/httpbasicpass admin

然后两次输入密码即可。

# more /home/lai/httpbasicpass           
admin:dH84ghAVHay72

 

2.在配置文件中最需要保护的部分<Directory>开启basic认证

    <Directory /data/webroot/mail_admin >
        AllowOverride All
        Order allow,deny
        Allow from all
        AuthType Basic
        AuthName "Restricted Mail Management System"
        AuthUserFile /home/lai/httpbasicpass 
        Require user admin
    </Directory>

 

3.重启apache

# /etc/init.d/apache2 restart 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM