v2-d.jpg
先在nginx.conf中的http模块下配置

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

区域名称one(自定义),占用空间大小为10m,平均处理请求速度不能超过每秒一次
在http模块的子模块server下配置

    location ~* .htm$ {
    limit_req zone=one burst=5  nodelay;
    proxy_pass http://backend_tomcat;
    }

burst 缓冲队列的长度
nodelay 不延迟
真正对限流起作用的就是rate=1r/s和burst=5这2个配置

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code