zl程序教程

您现在的位置是:首页 >  后端

当前栏目

重识Nginx - 09 使用Nginx内置变量$limit_rate实现带宽限速

变量Nginx 实现 使用 内置 limit 09 带宽
2023-06-13 09:13:43 时间

文章目录


官网

https://nginx.org/en/docs/

点击 Alphabetical index of variables

找到 https://nginx.org/en/docs/http/ngx_http_core_module.html#var_limit_rate


$limit_rate

Limits the rate of response transmission to a client. The rate is specified in bytes per second. The zero value disables rate limiting. The limit is set per a request, and so if a client simultaneously opens two connections, the overall rate will be twice as much as the specified limit.


实操

修改配置文件

[root@VM-0-7-centos ~]# vim ng/artisan_ng/conf/nginx.conf
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]# ./ng/artisan_ng/sbin/nginx -s reload
[root@VM-0-7-centos ~]#

重新访问

可以看到 $limit_rate生效了