Apache中限制和容許特定IP訪問
<Directory "/var/www">
Options All
AllowOverride None
Order Deny,Allow
Deny From all
Allow From 192.168.0.0/24
Allow From 127.0.0.1
Allow From 59.37.x.x/28
</Directory>
上面這一段的意思是對/var/www目錄下面的文件,只容許從192.168.0/24 和 127.0.一、59.37.x.x/28這幾個IP段內的用戶訪問.
下面的這一段與上面的恰好相反,禁止從192.168.0 和 127.0.1這兩個字段內的用戶訪問.
<Directory "/var/www">
Options All
AllowOverride None
Order Deny,Allow
Allow From all
Deny From 192.168.0
Deny From 127.0.0.1
</Directory>ide