Last active
August 29, 2015 14:19
-
-
Save Angelmmiguel/4b8b80dec76cf93d123a to your computer and use it in GitHub Desktop.
Stop SPAM Referrers on NGINX and Google Analytics
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
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; | |
} | |
# ... | |
} | |
} |
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regex based on this StackOverflow answer