Welcome! Log In Create A New Profile

Advanced

Re: Blocking by user agent if ip doesn't match

António P. P. Almeida
May 31, 2011 03:06PM
On 31 Mai 2011 19h49 WEST, nginx-forum@nginx.us wrote:

> Hello everyone. Sorry for double posting this question in How to
> section of the forum but I've noticed later there is a lot of
> un-replied threads there and that mailing list is more active so I
> am assuming I have more chance of getting some help here.
>
> I am hoping this is possible and I'd really appreciate some help on
> configuring it. We are having some bots on our site that are using
> google spider user agent but they are fake and their ip range has
> nothing to do with Google. So I am looking for some solution that
> would match visitors with user agent is Google who's ip doesn't
> start with for example 66.x or 70.x and block them from accessing.
>
> I've found this example on one site
> if ($http_user_agent ~ (Purebot|Lipperhey|MaMa
> CaSpEr|libwww-perl|Mail.Ru|gold crawler) ) {
> return 403;
> }

Try this:

if ($http_user_agent ~* "Google Bot") {
allow 66.x;
allow 70.x;
deny all;
}

--- appa


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Blocking by user agent if ip doesn't match

karabaja May 31, 2011 02:49PM

Re: Blocking by user agent if ip doesn't match

António P. P. Almeida May 31, 2011 03:06PM

Re: Blocking by user agent if ip doesn't match

Alexandr Gomoliako May 31, 2011 03:20PM

Re: Blocking by user agent if ip doesn't match

Igor Sysoev May 31, 2011 03:36PM

Re: Blocking by user agent if ip doesn't match

Alexandr Gomoliako May 31, 2011 04:36PM

Re: Blocking by user agent if ip doesn't match

António P. P. Almeida May 31, 2011 05:06PM

Re: Blocking by user agent if ip doesn't match

Alexandr Gomoliako May 31, 2011 05:30PM

Re: Blocking by user agent if ip doesn't match

Igor Sysoev June 01, 2011 03:26AM

Re: Blocking by user agent if ip doesn't match

Hari Hendaryanto June 01, 2011 04:48AM

Re: Blocking by user agent if ip doesn't match

Igor Sysoev June 01, 2011 04:50AM

Re: Blocking by user agent if ip doesn't match

karabaja May 31, 2011 06:01PM

Re: Blocking by user agent if ip doesn't match

António P. P. Almeida May 31, 2011 06:28PM

Re: Blocking by user agent if ip doesn't match

António P. P. Almeida May 31, 2011 06:34PM

Re: Blocking by user agent if ip doesn't match

karabaja May 31, 2011 06:44PM

Re: Blocking by user agent if ip doesn't match

António P. P. Almeida May 31, 2011 07:00PM

Re: Blocking by user agent if ip doesn't match

Igor Sysoev June 01, 2011 03:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 105
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready