Skip to content

Instantly share code, notes, and snippets.

@Angelmmiguel
Last active August 29, 2015 14:19
Show Gist options
  • Save Angelmmiguel/4b8b80dec76cf93d123a to your computer and use it in GitHub Desktop.
Save Angelmmiguel/4b8b80dec76cf93d123a to your computer and use it in GitHub Desktop.
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
@Angelmmiguel
Copy link
Author

Regex based on this StackOverflow answer

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