Skip to content

Instantly share code, notes, and snippets.

@rolandinsh
Created June 20, 2015 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolandinsh/93cb9a5f08f52d7065b4 to your computer and use it in GitHub Desktop.
Save rolandinsh/93cb9a5f08f52d7065b4 to your computer and use it in GitHub Desktop.
spammers in .sh file (by @lolwhoami)
#!/bin/sh
# Author: https://github.com/lolwhoami/referrer-spam-blacklist/commit/b25bb159d95c0fc82ea731750f0461bd85b72a91
# use this inside 'server { ... }'
#
# include spammers.nginx.conf;
# if($bad_referer) {
# return 444;
# }
conf='./spammers.nginx.conf'
echo 'map $http_referer $bad_referer {' > $conf
echo ' default 0;' >> $conf
for line in `cat spammers.txt`
do
echo ' "~'$line'" 1;' >> $conf
done
echo '}' >> $conf
@rolandinsh
Copy link
Author

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