My site is being attack by some abnormal client, with some invalid user-agent. They keep on scanning my server, and just keep on pushing up the server loading.
There is a lot of different defense method, and here is one of the simple solution (http://httpd.apache.org/docs/2.0/mod/mod_access.html). Just add the following lines (I just list those are required):
<VirtualHost *>
# You need to add these line in regex formatting
# Check your access log to find out those abnormal User-Agent
SetEnvIf User-Agent .*www\.pingdom\.com.* robot
SetEnvIf User-Agent .*blogspot\.com.* robot
SetEnvIf User-Agent ^$ robot
<Directory /var/www/>
AllowOverride None
Order allow,deny
allow from all
# Here we get the defined variable, and block them
deny from env=robot
</Directory>
</VirtualHost>And so Apache will happily block those unfriendly user agents ;-)


















Post new comment