In order for .htaccess files to work their use must be enabled in the main Apache configuration file. The main Apache configuration file (httpd.conf) needs to have the following statements in it somewhere (they do not have to be next to each other):
AccessFileName .htaccess
AllowOverride Limit
The AllowOverride statement can only be used in a Directory context. If you don't know what that means, you probably don't have your own Apache Web server which means you probably don't have access to the httpd.conf file anyway. However, most Web hosting companies that offer Apache (Linux) servers do have the use of .htaccess files enabled. (If you want to find out how to set up your own Web server see the "Internet Servers" page on our AboutDebian.com site.)
So how do you know what addresses are Chinese addresses? Luckily the Okean.com and Wizcraft.net Web sites maintain block lists of Chinese and Nigerian addresses. To block this traffic copy/paste the following deny statements after the order and allow statements in your .htaccess file like so:
To also block problem Russian traffic copy/paste these deny statements after the order and allow statements in your .htaccess file:
# Get up-to-date list from http://www.wizcrafts.net/russian-blocklist.html
# Russia and Ukraine and Bulgaria and Romania and Latvia and Estonia
deny from 77.120.0.0/14
deny from 78.106.0.0/15
deny from 79.120.0.0/17
deny from 80.73.64.0/21 80.85.176.0/20
deny from 81.19.64.0/19 81.95.144.0/20 81.176.0.0/15
deny from 82.76.0.0/14 82.103.64.0/18 82.138.6.128/25 82.144.192.0/19 82.151.112.0/21 82.160.203.0/24
deny from 83.219.129.0/24 83.237.0.0/16
deny from 85.14.35.0/24 85.112.112.0/20 85.140.0.0/15 85.142.0.0/15 85.192.60.0/23 85.249.128.0/19 85.255.112.0/20
deny from 86.127.19.0/24
deny from 87.99.64.0/19 87.103.192.0/20 87.120.16.0/20 87.242.116.0/23
deny from 89.122.0.0/16 89.37.144.0/21 89.111.176.0/20 89.175.0.0/16 89.178.0.0/15 89.190.224.0/19
deny from 91.76.0.0/14 91.124.0.0/16
deny from 141.85.0.0/16
deny from 192.129.3.0/24
deny from 193.39.113.0/24 193.47.166.0/24 193.178.144.0/22
deny from 194.44.36.0/24 194.186.0.0/16
deny from 195.28.32.0/19 195.34.224.0/19 195.95.218.0/23 195.5.116.0/23 195.137.200.0/23 195.138.198.0/24 195.189.246.0/23 195.208.0.0/15 195.225.176.0/22 195.239.0.0/16 195.242.98.0/23 195.244.128.128/25 195.245.112.0/23
deny from 212.24.32.0/19 212.58.192.0/19 212.158.160.0/20
deny from 213.91.128.0/17 213.140.96.0/19 213.154.192.0/19 213.242.12.0/22 213.248.48.0/20
deny from 217.12.240.0/20 217.16.16.0/20 217.77.208.0/20 217.174.96.0/20作者: 云解有情 时间: 2010-6-25 00:42