http {
....
limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
...
}
server
{
...
location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
...
expires 7d;
} location / {
limit_req zone=one ;
root html;
index index.html index.jsp;
...
}
}
这是配置文件,可是1秒发了第二个请求就显示503(总共发了好几个,不过非js.css.jpg等请求只有两个(是不同的请求)),我在limit_req zone=one 后面加上burst=1就可以了,我看了nginx的文档的意思,rate=10r/s;应该就是允许一秒10个,超过10个才跟burst有关,为什么rate=10r/s没起作用
....
limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
...
}
server
{
...
location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
...
expires 7d;
} location / {
limit_req zone=one ;
root html;
index index.html index.jsp;
...
}
}
这是配置文件,可是1秒发了第二个请求就显示503(总共发了好几个,不过非js.css.jpg等请求只有两个(是不同的请求)),我在limit_req zone=one 后面加上burst=1就可以了,我看了nginx的文档的意思,rate=10r/s;应该就是允许一秒10个,超过10个才跟burst有关,为什么rate=10r/s没起作用
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货