apache2 可以設定 特定資料夾 在瀏覽時需要輸入 帳號密碼

1.
在要認證的資料夾下新增「.htaccess」
其內容如下
AuthType Basic
AuthName "需要認證之資料"                                              # " "可行修改
AuthBasicProvider file
AuthUserFile /home/smalldd/WWW_auth/passwd           # 存放帳號密碼檔案的位置
Require user smalldd                                                              # 可以接受之帳號



2.
建立存放帳號密碼之檔案
htpasswd -c /home/smalldd/WWW_auth/passwd smalldd
接著會詢問帳號之密碼



連上apache2 看設定是否正確
設定正確會跳出認證對話框,且帳號密碼輸入後,即可登入
arrow
arrow
    全站熱搜

    smalldd 發表在 痞客邦 留言(0) 人氣()