Last active
September 4, 2015 22:43
-
-
Save reederz/b0aa902dc2dbe87b5a4c to your computer and use it in GitHub Desktop.
Block Referer Spam in NGINX ( blogpost detailing the process http://fadeit.dk/blog/post/nginx-referer-spam-blacklist )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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; | |
} | |
# ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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