如何阻止推荐垃圾邮件

How to block Referrer Spam

我正在使用 NGINX,但我的其中一个网站受到引荐来源垃圾邮件的困扰。

我关注了 NGINX wiki,我找到了 this 但是在使用代码后,它阻止了我的站点。有什么解决办法吗?我也尝试过使用此代码,但没有成功

if ($http_referer ~ "spamdomain1\.com|spamdomain2\.com|spamdomain3\.com")  { 
return 444;
}

我想阻止我获得推荐人点击的域。

我会用地图。

# at the http level:
map $http_referer $drop_referer {
    default 0;
    ~spamdomain1\.com   1;
    ~spamdomain2\.com   1;
    ~spamdomain3\.com   1;
    # ... (put these in an included file if there are many)
}

# in your server stanza:
if ($drop_referer) {
    return 444;
}

我们开始开发我们的内部工具 ReferrerSpamBot that helps adding the dynamic filters to your Google Analytics account and also we want to develop a module for nginx in the future. Check out the project on GitHub