Nginx限制ip并发数

Nginx限制ip并发数,也就是说限制同一个ip同时连接服务器的数量。

1、添加limit_zone
这个变量只能在http中使用。
vi /usr/local/nginx/conf/nginx.conf
limit_zone one $remote_addr 10m;

2、添加limit_conn
这个变量可以在http、server、location中使用。
limit_conn   one  10;

3、重启nginx
killall -HUP nginx

猜你喜欢

转载自eric-gao.iteye.com/blog/850785