write down,forget
  • adidaseqt
  • eqtturbored
  • eqtsupport9317
  • eqtsupport
  • 9317adidas
  • adidaseqtboost9317
  • eqtsupport93
  • 9317eqt
  • eqt support 9317 adv
  • support 9317 adv
  • eqtadv
  • eqt9317
  • eqtadv9317
  • support93
  • originalseqt
  • adidas eqt
  • eqt support 9317
  • eqt support
  • eqt adv
  • eqt 9317
  • nginx限速

    <Category: DevOPS, Web> 查看评论

    nginx限制ip并发数和访问频率以及下载速度

    限制并发

    nginx版本1.1.8 之后
    ngx_http_limit_zone_module 
    改名为:
    ngx_http_limit_conn_module

    http://.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn

    limit_zone指令改成limit_conn_zone了

    并且支持
    multiple limit_conn
    E.g. if you want to limit number of connections per ip *and* total 
    number of connections per virtual host.(即同时支持对对方ip和服务器自身的连接限制)

    perip是声明的limit_zone 的名字,$binary_remote_addr是替代 $remore_addr 的变量,10m 是会话状态储存的空间
    limit_conn perip 10;,限制客户端并发连接数量为1
    perserver是现在服务器总共处理连接数为100

    限制访问频率
    http://nginx.org/en/docs/http/ngx_http_limit_req_module.html

    上面的参数会让nginx 一秒钟只处理一个请求,但是仍然会有很多还在队列里面等待处理,这样也会占用很多tcp连接,从上面那条命令的结果中就能看得出来。
    如果加上nodelay就会立即丢弃
    limit_req zone=req_one burst=120 nodelay;

    限制下载速度

    参考:
    关于limit_zone:http://wiki.nginx.org/NginxHttpLimitZoneModule
    关于limit_rate和limit_conn:http://wiki.nginx.org/NginxHttpCoreModule
    limit_zone,是针对每个IP定义一个存储session状态的容器。这个示例中定义了一个10m的容器,按照32bytes/session,可以处理320000个session。
    limit_conn one 1;
    限制每个IP只能发起一个并发连接。
    limit_rate 300k;
    对每个连接限速300k. 注意,这里是对连接限速,而不是对IP限速。如果一个IP允许两个并发连接,那么这个IP就是限速limit_rate×2。

    An IP address of the client serves as a key. Note that instead of $remote_addr, the $binary_remote_addr variable is used here, allowing to lower the size of a state down to 64 bytes. One megabyte zone can keep about 16 thousand 64-byte states. If the storage for a zone is exhausted, the server will return error 503 (Service Temporarily Unavailable) to all further requests.
    The rate is specified in requests per second (r/s). If a rate of less than one request per second is desired, it is specified in request per minute (r/m). For example, half-request per second is 30r/m.

    源文档

    http://wiki.nginx.org/HttpLimitZoneModule
    http://blog.sina.com.cn/s/blog_6917c4aa0100ve5r.html
    http://storysky.blog.51cto.com/628458/642970/

    本文来自: nginx限速

    
    eqt support adidas eqt support 93 primeknit og colorway ba7506 adidas eqt running 93 updated with primeknit construction adidas eqt boost 93 17 white turbo red adidas eqt support 9317 white turbo red adidas eqt support 93 17 adidas eqt support 9317 adidas eqt support 9317 turbo red releases tomorrow adidas originals adidas eqt tactile green pack adidas eqt tactile green pack adidas eqt light green pack womens adidas eqt light green pack coming soon adidas eqt milled leather pack release date adidas originals eqt milled leather pack adidas eqt support ultra boost turbo red white adidas adv support burnt orange grey where to buy the adidas eqt support 9317 turbo red adidas eqt boost 91 16 turbo red adidas eqt support 93 turbo red adidas eqt support 9317 white turbo red available now