In an effort to help stop spam referrals from even entering your website, might as well just catch them and send them to a 403 or something.
There is a blacklist file available from perishablepress.com found here ultimate-referrer-blacklist.txt.
This file is useful, but it presents exactly one problem: It's in pseudo .htaccess. It's meant to be copied from and pasted into an .htaccess
file. Because there also exists a huge list of url patterns that comprises of about 90% of the txt that isn't .htaccess.
This is also not useful at all in any shape nor form as is to servers using Nginx who wish to make use of this list (like me).
What I have done is written a generic PHP script that downloads the file, runs through each line, and converts it into an nginx directive. The intent here is to run this file, and dump the output somewhere else on the server, in this case a new file called blacklist.conf
located in the core /etc/nginx
directory.
Within your server block in your sites-available configurations, you can simply use an include {file_path};
directive to bring it all in, and into as many server blocks as you want.
I am open to forks to improve this system, and additional scripting languages to accomplish the same goal.