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