Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
block spam referers in NGINX. Can be used as global block for all sites; (used on my production server(s))
# 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;
#}
@rolandinsh

This comment has been minimized.

Copy link
Owner Author

rolandinsh commented Apr 26, 2015

@rolandinsh

This comment has been minimized.

Copy link
Owner Author

rolandinsh commented Jun 20, 2015

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
You can’t perform that action at this time.