Skip to content

Instantly share code, notes, and snippets.

@reederz reederz/blacklist.conf
Last active Sep 4, 2015

Embed
What would you like to do?
Block Referer Spam in NGINX ( blogpost detailing the process http://fadeit.dk/blog/post/nginx-referer-spam-blacklist )
# /etc/nginx/blacklist.conf
map $http_referer $bad_referer {
hostnames;
default 0;
"~social-buttons.com" 1;
"~semalt.com" 1;
"~kambasoft.com" 1;
"~savetubevideo.com" 1;
"~descargar-musica-gratis.net" 1;
"~7makemoneyonline.com" 1;
"~baixar-musicas-gratis.com" 1;
"~iloveitaly.com" 1;
"~ilovevitaly.ru" 1;
"~fbdownloader.com" 1;
"~econom.co" 1;
"~buttons-for-website.com" 1;
"~buttons-for-your-website.com" 1;
"~srecorder.co" 1;
"~darodar.com" 1;
"~priceg.com" 1;
"~blackhatworth.com" 1;
"~adviceforum.info" 1;
"~hulfingtonpost.com" 1;
"~best-seo-solution.com" 1;
"~googlsucks.com" 1;
"~theguardlan.com" 1;
"~i-x.wiki" 1;
"~buy-cheap-online.info" 1;
"~Get-Free-Traffic-Now.com" 1;
}
# /etc/nginx/sites-enabled/mysite.conf
# Add the below condition to the sites where you want to block referer spam.
server {
# ...
if ($bad_referer) {
return 403;
}
# ...
}
# /etc/nginx/nginx.conf
# Your nginx.conf file is definitely bigger than this. Just add include line in there
http {
# ...
include blacklist.conf;
# ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.