
nginx做反向代理使用.在遭遇CC攻击时候.进行一些简单的过滤设置.可以起到很好的效果的.
这里就说针对一种情况作策略吧.
目前在网上google到的案例中的写法中我做过测试.貌似并不有效.可能他的环境与我不同.他的环境中是nginx提供web服务的写法
而在nginx做反向代理的时候.貌似要写在location段中.
下面我把两种写法都放在下面:
nginx提供web服务:
分析访问日志如“Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; MyIE 3.01)Cache-Control: no-store, must-revalidate”
用must-revalidate做为关键词,在nginx.conf中的 server段中添加几句
用must-revalidate做为关键词,在nginx.conf中的 server段中添加几句
if ($http_user_agent ~ must-revalidate) {
return 503;
}
nginx做反向代理:
在location
location / {
#if ($http_user_agent ~* " must-revalidate") {
#return 503;
#}