我在Nginx服务器下运行两个mongrels.我不断收到不存在文件的请求.IP地址经常更改,但引用URL保持不变.我想解决这个问题.
https://calomel.org/nginx.html
阻止大多数"推荐人垃圾邮件" - "更多的是烦恼而不是问题"
nginx.conf
## Deny certain Referers (case insensitive) ## The ~* makes it case insensitive as opposed to just a ~ if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo)) { return 403; }
随着列表变长,使用Nginx 映射模块会更高效,更易于管理.
把它放在你的http {}块中:
map $http_referer $bad_referer { hostnames; default 0; # Put regexes for undesired referers here "~social-buttons.com" 1; "~semalt.com" 1; "~kambasoft.com" 1; "~savetubevideo.com" 1; "~descargar-musica-gratis.net" 1; "~7makemoneyonline.com" 1; "~baixar-musicas-gratis.com" 1; "~iloveitaly.com" 1; "~ilovevitaly.ru" 1; "~fbdownloader.com" 1; "~econom.co" 1; "~buttons-for-website.com" 1; "~buttons-for-your-website.com" 1; "~srecorder.co" 1; "~darodar.com" 1; "~priceg.com" 1; "~blackhatworth.com" 1; "~adviceforum.info" 1; "~hulfingtonpost.com" 1; "~best-seo-solution.com" 1; "~googlsucks.com" 1; "~theguardlan.com" 1; "~i-x.wiki" 1; "~buy-cheap-online.info" 1; "~Get-Free-Traffic-Now.com" 1; }
把它放在你的服务器{}块中:
if ($bad_referer) { return 444; # emtpy response }
它对我有用.
来自http://fadeit.dk/blog/post/nginx-referer-spam-blacklist