Last active
August 29, 2015 14:19
-
-
Save rolandinsh/52197d4d4feb37dffe9b to your computer and use it in GitHub Desktop.
block spam referers in NGINX. Can be used as global block for all sites; (used on my production server(s))
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
# Block semalt.com buttons-for-website.com buttons-for-your-website.com best-seo-offer.com 100dollars-seo.com semaltmedia.com as referral spam | |
# (c) 2015 Rolands Umbrovskis, http://umbrovskis.com | |
# if code above do not work: | |
if ($http_referer ~ "(semaltmedia\.com|100dollars-seo\.com|semalt\.com|buttons-for-website.com|buttons-for-your-website\.com|best-seo-offer\.com)") { | |
set $prohibited "1"; | |
} | |
if ($prohibited) { | |
return 403; | |
} | |
## | |
# Version 2 | |
## | |
#if ($http_referer ~* "(semaltmedia\.com|100dollars-seo\.com|semalt\.com|buttons-for-website.com|buttons-for-your-website\.com|best-seo-offer\.com)"){ | |
# return 403; | |
#} |
see also: https://gist.github.com/rolandinsh/93cb9a5f08f52d7065b4 creating config file for nginx with .sh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apache version here https://gist.github.com/rolandinsh/4b6cbfcb817de1dcc78c