Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Stop SPAM Referrers on NGINX and Google Analytics
server {
# ...
location / {
# ...
# Stop SPAM Referrers
if ($http_referer ~* (Free-Traffic|babes|click|diamond|forsale|girl|jewelry|love|nudit|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo|social-buttons|simple-share-buttons|free-share-buttons)){
return 403;
}
# ...
}
}
Free-Traffic|babes|click|diamond|forsale|girl|jewelry|love|nudit|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo|social-buttons|simple-share-buttons|free-share-buttons
Owner

Angelmmiguel commented Apr 22, 2015

Regex based on this StackOverflow answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment