nginx如何限速?

nginx自从1.1.8版本发布后将limit_conn更换为limit_conn_zone 。

对应则需要修改配置文件

在nginx.conf的http下面加入下面代码
limit_conn_zone $binary_remote_addr zone=addr:10m;
在站点的server区域加入下面代码

location / {
limit_conn addr 1;
limit_rate 300k;
}
这样限速为300k
然后重载nginx配置文件 service nginx reload
交流QQ:2881064156

原文地址:https://www.cnblogs.com/Q2881064156/p/5789682.html