咨询热线:4006-75-4006

售前:9:00-23:30    备案:9:00-18:00    技术:7*24h

Nginx控制并发连接

2016-08-27 15:09:27 9321次

你可以使用NginxHttpLimitZone模块来限制指定的会话或者一个IP地址的特殊情况下的并发连接。编辑nginx.conf:

  1. ### Directive describes the zone, in which the session states are stored i.e. store in slimits. ###

  2. ### 1m can handle 32000 sessions with 32 bytes/session, set to 5m x 32000 session ###

  3. limit_zone slimits $binary_remote_addr 5m;

  4. ### Control maximum number of simultaneous connections for one session i.e. ###

  5. ### restricts the amount of connections from a single ip address ###

  6. limit_conn slimits 5;

上面表示限制每个远程IP地址的客户端同时打开连接不能超过5个。

 



首页
最新活动
个人中心