| From | Sent On | Attachments |
|---|---|---|
| karabaja | May 31, 2011 11:49 am | |
| António P. P. Almeida | May 31, 2011 12:04 pm | |
| Alexandr Gomoliako | May 31, 2011 12:18 pm | |
| Igor Sysoev | May 31, 2011 12:34 pm | |
| Alexandr Gomoliako | May 31, 2011 1:34 pm | |
| António P. P. Almeida | May 31, 2011 2:03 pm | |
| Alexandr Gomoliako | May 31, 2011 2:27 pm | |
| karabaja | May 31, 2011 3:00 pm | |
| António P. P. Almeida | May 31, 2011 3:25 pm | |
| António P. P. Almeida | May 31, 2011 3:31 pm | |
| karabaja | May 31, 2011 3:44 pm | |
| António P. P. Almeida | May 31, 2011 3:57 pm | |
| Igor Sysoev | Jun 1, 2011 12:24 am | |
| Igor Sysoev | Jun 1, 2011 12:27 am | |
| Hari Hendaryanto | Jun 1, 2011 1:41 am | |
| Igor Sysoev | Jun 1, 2011 1:47 am |
| Subject: | Re: Blocking by user agent if ip doesn't match | |
|---|---|---|
| From: | António P. P. Almeida (ap...@perusio.net) | |
| Date: | May 31, 2011 3:25:08 pm | |
| List: | ru.sysoev.nginx | |
On 31 Mai 2011 23h01 WEST, ngin...@nginx.us wrote:
Thanks everyone for being so helpful. I've ended up applying Igor's suggestion. But I've dropped this line as I wasn't sure what to do with it: "~(?i)(Purebot|Lipperhey|MaMaCaSpEr|libwww-perl|Mail.Ru|gold crawler)" 1;
I am guessing it can be used if I want to match more then just google's user agent. But in any case what I did worked very nice. I tested it using Firefox user agent and I got forbidden page, then tried adding my ip to geo bit and I was allowed.
Yes following Alexandr and Igor's advice you can create similar variables using more IP blocks inside the geo directive. E.g.:
geo $bad_bot { default 1; 66.0.0.0/8 0; xx.yy.zz.ww/16 1; # for Yahoo! (...) }
You'll need also to add the regexes for User Agent string of the remaining bots that you want to whitelist in the map directive.
map $http_user_agent $bots { default 0; ~(?i)(google|yahoo) $bad_bot; }
--- appa
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx





