09、Nginx实战:使用Nginx内置变量$limit_rate实现带宽限速

文章目录

  • 官网
  • $limit_rate
  • 实操

*


官网

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生效了

*

版权声明:本文不是「本站」原创文章,版权归原作者所有 | 原文地址: