How to block referral spam using Nginx?

后端 未结 4 1395
甜味超标
甜味超标 2021-02-01 10:01

I\'m running two mongrels under an Nginx server. I keep getting requests for a nonexistent file. The IP addresses change frequently but the referring URL stays the same. I\'d

4条回答
  •  抹茶落季
    2021-02-01 10:39

    https://calomel.org/nginx.html

    Block most "referrer spam" -- "more of an annoyance than a problem"

    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;   }
    

提交回复
热议问题