apache限制ip和用戶認證的混合使用方法一

#DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
DocumentRoot "D:/vss"                    #修改root文件夾
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features. 
#
<Directory />                                      #設定/backup目錄工作方式
    Options Indexes FollowSymLinks   #Indexes表示當沒有index頁面時,顯示文件夾
    AllowOverride None                       #不接受.htaccess中的設定 
    Order Deny,Allow                           #先禁止,再允許
    Deny from all                                  #禁止所有計算機訪問該文件夾
    Allow from 10.0.0.0/8                      #只允許10.0.0.0/8網段訪問該文件夾
#    Allow from 10.0.0.52 10.0.0.24
</Directory>

<Directory "D:/vss/data">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order Deny,Allow
    Deny from all
    Allow from 10.0.0.0/8
    AuthType Basic                                 #定義認證區域和名稱        
    AuthName "VSS"
    AuthUserFile C:/PASSWD/passwd    #定義認證文件名
    require user tyl test
</Directory>

<Directory "D:/vss/users">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order Deny,Allow
    Deny from all
    Allow from 10.0.0.0/8
    AuthType Basic
    AuthName "VSS"
    AuthUserFile C:/PASSWD/passwd
    require user test1
</Directory>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章