在Apache2.4中需要使用Require訪問控制指令。使用require指令…
在Apache2.4中需要使用Require訪問控制指令。使用require指令時,需要在指令外添加<RequireAll></RequireAll>標簽對,否則重啟Apache2.4加載規則時將出現錯誤:” negative Require directive has no effect in <RequireAny> directive “。
下面對Require指令的使用進行說明:
<Directory /www/> Options FollowSymLinks AllowOverride All SetEnvIfNoCase User-Agent ^.*Apache-HttpClient.* bad_bot #User-Agent包含Apache-HttpClient的規則 <RequireAll> Require all granted #允許所有 Require all denied #拒絕所有 Require not ip 64.64.108.70 #屏蔽IP Require not ip 64.64 #屏蔽IP段 Require not env bad_bot #屏蔽上面設置的規則 </RequireAll> </Directory>