Nginx: How To Stop Referrer Spam With Keyword Filtering
You can configure Nginx to stop referrer spam by checking for bad keywords like tramadol, phentermine etc. This reduces the load on your server as well as prevents filling your referrer logs with invalid entries. Here is my nginx configuration to stop referrer spam (feel free to copy it):
# 403 forbidden based on http referer
if ($http_referer ~* "tramadol|viagra|levitra|adipex|virex|antispysoft2005\.com|mydivx\.info|my-pills\.be|cameralover\.net|credit-dreams\.com|the-discount-store\.com|bayfronthomes\.net|casino|poker|hackerssupply\.com|hydrocodone|cafexml\.com|yelucie\.com|crescentarian\.net|andrewsaluk\.com|tigerspice|doobu\.com|camfun24|latinonakedgirl|ronnieazza\.com|highprofitclub|dvdsqueeze\.com|sexsearchcom\.com|6q\.org|d4f\.de|adultactioncam|seventwentyfour\.com|genaholincorporated\.com|firsthorizonmtg\.com|personalsites\.info|bukakke-bukake-bukkake-bukkakke\.com|camgirlslive\.com|dvd-copy\.com|shaffelrecords\.com|mcr8\.com|dating\.blogs\.com|online-casino-pops|8thstreetlatinas|boysfirsttime\.com|gofordgo\.com|chile-online\.com|buy-hgh-human-growth-hormone\.net") {
return 403;
}
You can configure Nginx to stop referrer spam by checking for bad keywords like tramadol, phentermine etc. This reduces the load on your server as well as prevents filling your referrer logs with invalid entries. Here is my nginx configuration to stop referrer spam (feel free to copy it):
# 403 forbidden based on http referer
if ($http_referer ~* "tramadol|viagra|levitra|adipex|virex|antispysoft2005\.com|mydivx\.info|my-pills\.be|cameralover\.net|credit-dreams\.com|the-discount-store\.com|bayfronthomes\.net|casino|poker|hackerssupply\.com|hydrocodone|cafexml\.com|yelucie\.com|crescentarian\.net|andrewsaluk\.com|tigerspice|doobu\.com|camfun24|latinonakedgirl|ronnieazza\.com|highprofitclub|dvdsqueeze\.com|sexsearchcom\.com|6q\.org|d4f\.de|adultactioncam|seventwentyfour\.com|genaholincorporated\.com|firsthorizonmtg\.com|personalsites\.info|bukakke-bukake-bukkake-bukkakke\.com|camgirlslive\.com|dvd-copy\.com|shaffelrecords\.com|mcr8\.com|dating\.blogs\.com|online-casino-pops|8thstreetlatinas|boysfirsttime\.com|gofordgo\.com|chile-online\.com|buy-hgh-human-growth-hormone\.net") {
return 403;
}