Why bootdev — Nginx conf extended

Originally posted on Keith Yau:

Recently, one of our Drupal stack really high CPU, It do monthly increased 30% RPM (request per minute) from new relic. BTW, i think its CPU wont increase like 40%. During my investigation,

  1. some robots scan can somehow eat your CPU. Like many robots will look for wp-login as it guess you are wordpress site and more.
  2. Your CDN may pull your data but goes to a wrong URL and have a ERROR in your php-fpm log
  3. robot from same IP address(es) keep scan your site

We here added some conf which help about 6-7% CPU decrease for a 300-400 RPM Drupal site.

#Set a limit connection zone

limit_conn_zone $binary_remote_addr zone=gulag:5m;

#Check robot

map $http_user_agent $is_bot {

default  ”;

~*crawl|goog|yahoo|yandex|spider|bot|tracker|click|parser is_bot;

}

###

### Send all known bots to $args free URLs.

###

location @nobots {

if ($is_bot) {

rewrite ^ $scheme://$host$uri? permanent;

}

rewrite ^/(.*)$  /index.php?q=$1 last;

}

#In…

View original 114 more words

Flat 607, 6/F, Yen Sheung Center, 64 Hoi Yuen Road, Kwun Tong

General Enquiry: info at yubis.net
Website: http://www.yubis.net