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沒起作用
uj5u.com熱心網友回復:
你放在location /下面當然了,js.css.jpg也計算到請求里面去了,一個頁面幾十個請求,可不超過10了么轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/58945.html
標籤:服務器
