我正在使用Nginx-1.6.2,2并且我想为与/browse.PHP?u=http匹配的URL返回错误410,因此这样的请求将获得410:
原文链接:https://www.f2er.com/regex/357047.html162.218.208.16 - - [21/Nov/2014:12:35:40 -0500] "GET /browse.PHP?u=http%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3DBroke%2C%2BUSA%2Bfiletype%3Apdf%26first%3D0%26count%3D20%26format%3DRSS&b=156&f=norefer HTTP/1.1" 403 570 "http://ww.thespacesurf.com/browse.PHP?u=http%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3DBroke%2C%2BUSA%2Bfiletype%3Apdf%26first%3D0%26count%3D20%26format%3DRSS&b=156&f=norefer" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
我真的不需要正则表达式,所以这样的东西,但它不起作用:
location = /browse.PHP?u=http { return 410; }
几天后,我在/var/log/Nginx-access.log中grep -c为410
$bzip2 -cd /var/log/Nginx-access.log.0.bz2 | grep -c ' 410 ' 5665 $
这让我感到温暖和模糊)再次感谢!