在Apache2.4中需要使用Require訪問控制指令。使用require指令…
當(dāng)前位置:網(wǎng)站首頁 > 幫助中心 > 正文
在Apache2.4中需要使用Require訪問控制指令。使用require指令時,需要在指令外添加<RequireAll></RequireAll>標(biāo)簽對,否則重啟Apache2.4加載規(guī)則時將出現(xiàn)錯誤:” negative Require directive has no effect in <RequireAny> directive “。
下面對Require指令的使用進(jìn)行說明:
<Directory /www/>
Options FollowSymLinks
AllowOverride All
SetEnvIfNoCase User-Agent ^.*Apache-HttpClient.* bad_bot #User-Agent包含Apache-HttpClient的規(guī)則
<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 #屏蔽上面設(shè)置的規(guī)則
</RequireAll>
</Directory>