当前位置:网站首页>nignx配置单ip限流
nignx配置单ip限流
2022-06-27 03:46:00 【hshshshshs1】
1.http里面的配置
limit_req_zone $binary_remote_addr zone=rateLimit:10m rate=2r/s;

1.$binary_remote_addr 是设置的单ip,不是总的并发量
2.rateLimit是一个变量跟server里面写的一样就可以,有的是认驼峰,可以改为ratelimit等
3.2r/s 是针对同一个ip每秒限制2次请求
3.limit_req_zone必须结合limit_req才能生效
2.server里面的配置
location ~ \.php$ {
limit_req zone=rateLimit burst=5 nodelay;
……
}

1.burst 是桶的概念,可以理解为队列,
2.若rate=2r/s,burst =1,在所有请求不释放的情况下,前2个请求正常访问,第3个请求进入队列,第4个请求的时候就会报503
3.测试的时候就是快速的刷新就可以
3 .错误
我本地是laradock,直接添加就可以,但是宝塔上配置有一些区别
1.在宝塔上的配置,http里面的limit_req_zone $binary_remote_addr zone=rateLimit:10m rate=2r/s;是一样的
2.server里面的配置
先注释了,换成下面的代码就可以了
里面的代码是从enable-php-73.conf里面粘出来的
边栏推荐
- Pat grade a 1019 general palindromic number
- TopoLVM: 基于LVM的Kubernetes本地持久化方案,容量感知,动态创建PV,轻松使用本地磁盘
- Human soberness: bottom logic and top cognition
- [promise I] introduction of promise and key issues of hand rolling
- 超級詳細,2 萬字詳解,吃透 ES!
- 投资理财产品的钱有保障吗?会不会没有了?
- 办公室VR黄片,骚操作!微软HoloLens之父辞职!
- jmeter分布式压测
- Knowledge of iPhone certificate structure
- TP5 spreadsheet excel table export
猜你喜欢

iOS开发:对于动态库共享缓存(dyld)的了解

PAT甲级 1024 Palindromic Number

Products change the world

Pat grade a 1025 pat ranking

PostgreSQL基础命令教程:创建新用户admin来访问PostgreSQL

jmeter将上一个请求的结果作为下一个请求的参数

PAT甲级 1023 Have Fun with Numbers

WPF 开源控件库Extended WPF Toolkit介绍(经典)
![Promise source code class version [III. promise source code] [detailed code comments / complete test cases]](/img/51/e1c7d5a7241a6eca6c179ac2cb9088.png)
Promise source code class version [III. promise source code] [detailed code comments / complete test cases]

Nacos调用微服务两个问题:1.Load balancer does not contain an instance for the service 2.Connection refused
随机推荐
ESP8266
733. 图像渲染
如何系统学习LabVIEW?
How does the brain do arithmetic? Both addition and subtraction methods have special neurons, and the symbol text can activate the same group of cell sub journals
2021:Beyond Question-Based Biases:Assessing Multimodal Shortcut Learning in Visual Question Answeri
LDR6028 手机设备一边充电一边OTG传输数据方案
基于MobileNet-Yolov4搭建轻量化目标检测
快速掌握 ASP.NET 身份认证框架 Identity - 通过邮件重置密码
Logarithm
PAT甲级 1020 Tree Traversals
Usage knowledge of mobile phones in new fields
Pat class a 1024 palindromic number
清华&华为等 综述 | 语义通信:原则与挑战
PAT甲级 1025 PAT Ranking
How can e-commerce products be promoted and advertised on Zhihu?
733. image rendering
Anaconda3安装过程及安装后缺失大量文件,没有scripts等目录
静态时序分析-OCV和time derate
2021:AdaVQA: Overcoming Language Priors with Adapted Margin Cosine Loss∗自适应的边缘余弦损失解决语言先验
Products change the world