Posted by eule on July 24, 2014 at 8:10pm
Hello,
here is my blacklist.conf file who i try to deny some bots, but i get the error "nginx: [emerg] invalid number of the map parameters in /etc/nginx/blacklist.conf:12"
if i do this in a server location it works fine but not with the blacklist.conf from perusio ...whats wrong??
#-- mode: nginx; mode: flyspell-prog; ispell-local-dictionary: "american" --
### This file implements a blacklist for certain user agents and
### referrers. It's a first line of defense. It must be included
### inside a http block.
## Add here all user agents that are to be blocked.
map $http_user_agent $bad_bot {
default 0;
~*^Lynx 0; # Let Lynx go through
libwww-perl 1;
~(?i)(XoviBot/2.0|XoviBot/1.0|DotBot/1.1|validator|Validator|FrontPage|mmcrawler|SuperInfobot|superinfobot|Jenaie|jenaie|boitho|girafabot|ZmEu|larbin|SiteExplorer/1.0b|Jetslide|spbot/4.0.9|uMBot-LN/1.0|Ezooms/1.0|rogerbot/1.0|meanpathbot/1.0|mj12bot|MJ12bot|MJ12bot/v1.4.4|MJ12bot/v1.4.5|ia_archiver|SEOstats 2.0.9|Java/1.4.1_04|magpie-crawler/1.1|AhrefsBot/5.0|AhrefsBot.Feeds v0.1|iCjobs/3.2.3|Indy Library|httrack|htmlparser|libwww|sistrix|Alexibot|Art-Online|asterias|BackDoorbot|Black.Hole|\BlackWidow|BlowFish|botALot|BuiltbotTough|Bullseye|BunnySlippers|Cegbfeieh|Cheesebot) 1;
}
## Add here all referrers that are to blocked.
map $http_referer $bad_referer {
default 0;
~(?i)(adult|viagra|drug|drugs|viagra|babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo|bibelarbeit|pressebistro|yourdomain|xmaster|xopy|xxx) 1;
}
## Add here all hosts that should be spared any referrer checking.
geo $bad_referer {
127.0.0.1 0;
192.168.1.0/24 0;
}xxx@xxx:~# nginx -t
nginx: [emerg] invalid number of the map parameters in /etc/nginx/blacklist.conf:12
nginx: configuration file /etc/nginx/nginx.conf test failed
