Join the community today
Register Now

Nginx How to Block Yandex Bot ?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Yohan, Sep 24, 2015.

  1. Yohan

    Yohan Member

    68
    3
    8
    Sep 24, 2015
    Ratings:
    +4
    Local Time:
    1:11 PM
    1.9.x
    MariaDB 10
    Hello , On my site all the way too many hits from Yandex Bot , i wanna help to block it .. how i can do that ?

    Server
    CentOS Linux 7 (Core) x64
    v1.2.3-eva2000.08 ( Centminmod)

    Thanks :)
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,155
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    5:41 PM
    Nginx 1.13.x
    MariaDB 5.5
    your Centmin Mod install has a commented out include file in each vhost for /usr/local/nginx/conf/block.conf in it there's examples for blocking by user agent - github copy centminmod/block.conf at master · centminmod/centminmod · GitHub

    i.e.
    Code:
        if ($http_user_agent ~ "Acunetix") {
            set $block_user_agents 1;
        }
    
        if ($block_user_agents = 1) {
            return 403;
        }
     
  3. Yohan

    Yohan Member

    68
    3
    8
    Sep 24, 2015
    Ratings:
    +4
    Local Time:
    1:11 PM
    1.9.x
    MariaDB 10
    so example i have to had new rule to block.conf

    if ($http_user_agent ~ "Yandex") { set $block_user_agents 1; }

    ?

    i have attached screen

    Thanks
     

    Attached Files:

  4. Yohan

    Yohan Member

    68
    3
    8
    Sep 24, 2015
    Ratings:
    +4
    Local Time:
    1:11 PM
    1.9.x
    MariaDB 10
    and also i didn't found in vhost and commented block.conf
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,155
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    5:41 PM
    Nginx 1.13.x
    MariaDB 5.5
    that's it

    would be
    Code:
    #include /usr/local/nginx/conf/block.conf;
     
  6. Yohan

    Yohan Member

    68
    3
    8
    Sep 24, 2015
    Ratings:
    +4
    Local Time:
    1:11 PM
    1.9.x
    MariaDB 10
    WOW!! Its worked !! i manual added it thank you so much !!
     
    • Like Like x 1