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

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

20200103193054943.png

官网

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

e8d402c8c3b64723b8063c79e9e4e0e2.png


点击 Alphabetical index of variables


359b0356294746b9b16471870ca6e854.png


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


2d6b1ef6bf2043eb8bee9205afae24e1.png

$limit_rate


f68636fa1f92469c8d1a12094b6aa2e6.png


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.


实操

修改配置文件


c8b6fc4eab0d40dca3cc144442951468.png

[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 ~]#

重新访问



357aa697b0be48e598dd8d9f53377d92.png


可以看到 $limit_rate生效了

相关文章
|
9月前
|
应用服务中间件 nginx
|
5天前
|
应用服务中间件 数据库 nginx
nginx 第三方模块 与变量
nginx 第三方模块 与变量
|
8月前
|
存储 算法 应用服务中间件
Nginx之带宽限制解读
Nginx之带宽限制解读
|
物联网 应用服务中间件 nginx
重识Nginx - 15 使用信号管理Nginx的父子进程
重识Nginx - 15 使用信号管理Nginx的父子进程
72 0
|
缓存 网络协议 应用服务中间件
重识Nginx - 14 Nginx 多进程结构
重识Nginx - 14 Nginx 多进程结构
90 0
|
应用服务中间件 数据安全/隐私保护 nginx
重识Nginx - 13 对称加密与非对称加密的应用场景 & Nginx性能指标
重识Nginx - 13 对称加密与非对称加密的应用场景 & Nginx性能指标
103 0
|
安全 算法 应用服务中间件
重识Nginx - 12 SSL/TLS 浅析
重识Nginx - 12 SSL/TLS 浅析
82 0
|
缓存 应用服务中间件 nginx
重识Nginx - 11 使用ngx_http_proxy_module的proxy_cache搭建一个具备缓存功能的反向代理服务
重识Nginx - 11 使用ngx_http_proxy_module的proxy_cache搭建一个具备缓存功能的反向代理服务
187 0
|
监控 数据可视化 应用服务中间件
重识Nginx - 10 ngx_http_log_module日志模块 & GoAccess日志分析
重识Nginx - 10 ngx_http_log_module日志模块 & GoAccess日志分析
87 0
|
JSON 应用服务中间件 nginx
重识Nginx - 08 使用ngx_http_autoindex_module实现目录浏览功能
重识Nginx - 08 使用ngx_http_autoindex_module实现目录浏览功能
92 0