SlideShare a Scribd company logo
1
Rate limiting with NGINX
and NGINX PLUS
July 2017
2
Overview: What is Rate Limiting with NGINX?
3
Agenda
• Basic configurations and concepts
• Useful additional features
• Access logging and error codes
• Advanced configurations and concepts
• LIVE DEMO !
4
01
Basic configurations and concepts
5
limit_req_zone
Syntax: limit_req_zone key-name zone=alias:size rate=10r/s;
Context: http
Default: -
Definition: Define a rate limiting object with a key, shared memory
zone, and request rate associated with it.
6
limit_req
Syntax: limit_req zone=alias;
Context: http, server, location
Default: -
Definition: Instantiate the rate limiting object defined in the previous
slide using the zone alias.
7
Configuration example
8
The burst parameter with limit_req
Syntax: limit_req zone=alias burst=10;
Context: http, server, location
Default: -
Definition: The number of requests in excess of the rate specified in
the rate limiting object defined in the limit_req_zone directive
9
10
Nodelay parameter with limit_req
Syntax: limit_req zone=alias burst=10 nodelay
Context: http, server, location
Default: -
Definition: Impose a rate limit while servicing many simultaneous
user requests with no delay
11
12
Configuration example
13
01
Access logging and error statuses
14
limit_req_log_level
Syntax: limit_req_log_level info | notice | warn | error;
Default: limit_req_log_level error
Context: http, server, location
Fields in the log entry include:
● Limiting requests;
● Excess
● Zone
● ClientServer
● Request
● Host 15
Configure error code sent to client
Syntax: limit_req_status_code code
Default: limit_req_status_code 503;
Context: http, server, location
Definition: Set the error status code sent to the client when the number of requests
exceeds the request rate.
16
01
Advanced configurations and concepts
17
Imposing rate limits on whitelisted users
The geo block helps you create variables depending on the client IP address.
geo $marshaller {
default 0
192.168.56.101/20 1
}
The map block creates a new variable (second parameter) whose value depends on
variable specified in the first parameter.
map $marshaller $limit {
0 “”
1 $binary_remote_addr
}
18
Configuration example
19
01
LIVE DEMO !
20
01
Q&A
21
01
Start a 30 day free trial of NGINX Plus today
22
https://www.nginx.com/free-trial-request/

More Related Content

PPTX
Introduction to NGINX web server
PDF
Nginx Essential
PPTX
Learn nginx in 90mins
PDF
Using NGINX as an Effective and Highly Available Content Cache
PPTX
5 things you didn't know nginx could do
PPTX
Prometheus design and philosophy
ODP
Introduction to Nginx
Introduction to NGINX web server
Nginx Essential
Learn nginx in 90mins
Using NGINX as an Effective and Highly Available Content Cache
5 things you didn't know nginx could do
Prometheus design and philosophy
Introduction to Nginx

What's hot (20)

PPTX
Mule access management - Managing Environments and Permissions
PPTX
Hadoop Security Today & Tomorrow with Apache Knox
PDF
Ansible, best practices
PPTX
REST API
PDF
HTTP Request Smuggling via higher HTTP versions
PPTX
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
PDF
Prometheus
PDF
Learn how to use Harbor
PPTX
NGINX: Basics and Best Practices
PPTX
Introduction to Ansible
PDF
Cilium - Fast IPv6 Container Networking with BPF and XDP
PDF
Ansible
PDF
Operating PostgreSQL at Scale with Kubernetes
PDF
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
PDF
Docker swarm introduction
ODP
ansible why ?
PPTX
RedisConf17- Using Redis at scale @ Twitter
PPTX
PPTX
API LifeCycle Management
PPTX
Mule access management - Managing Environments and Permissions
Hadoop Security Today & Tomorrow with Apache Knox
Ansible, best practices
REST API
HTTP Request Smuggling via higher HTTP versions
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Prometheus
Learn how to use Harbor
NGINX: Basics and Best Practices
Introduction to Ansible
Cilium - Fast IPv6 Container Networking with BPF and XDP
Ansible
Operating PostgreSQL at Scale with Kubernetes
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
Docker swarm introduction
ansible why ?
RedisConf17- Using Redis at scale @ Twitter
API LifeCycle Management
Ad

Similar to Rate Limiting with NGINX and NGINX Plus (20)

PPTX
NGINX Plus R20 Webinar
PPTX
NGINX Plus R20 Webinar EMEA
PPTX
What's New in NGINX Plus R8
PDF
NGINX Plus R19 : EMEA
PDF
What’s New in NGINX Plus R16? – EMEA
PPTX
What's new in NGINX Plus R19
PPTX
What’s New in NGINX Plus R16?
PPTX
Rate limits and all about
PDF
ModSecurity and NGINX: Tuning the OWASP Core Rule Set - EMEA
PDF
Optimizing ModSecurity on NGINX and NGINX Plus
PPTX
What's New in NGINX Plus R7?
PDF
NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
PPTX
5 things you didn't know nginx could do velocity
PPTX
Flawless Application Delivery with NGINX Plus
PPTX
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
PPTX
What's New in NGINX Plus R10?
PDF
What’s New in NGINX Plus R15? - EMEA
PDF
How to Shrink from 5 Tiers to 2 in a Multitier Microservices Architecture
PPTX
NGINX Plus PLATFORM For Flawless Application Delivery
PDF
NGINX: Basics and Best Practices EMEA
NGINX Plus R20 Webinar
NGINX Plus R20 Webinar EMEA
What's New in NGINX Plus R8
NGINX Plus R19 : EMEA
What’s New in NGINX Plus R16? – EMEA
What's new in NGINX Plus R19
What’s New in NGINX Plus R16?
Rate limits and all about
ModSecurity and NGINX: Tuning the OWASP Core Rule Set - EMEA
Optimizing ModSecurity on NGINX and NGINX Plus
What's New in NGINX Plus R7?
NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
5 things you didn't know nginx could do velocity
Flawless Application Delivery with NGINX Plus
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
What's New in NGINX Plus R10?
What’s New in NGINX Plus R15? - EMEA
How to Shrink from 5 Tiers to 2 in a Multitier Microservices Architecture
NGINX Plus PLATFORM For Flawless Application Delivery
NGINX: Basics and Best Practices EMEA
Ad

More from NGINX, Inc. (20)

PDF
【NGINXセミナー】 Ingressを使ってマイクロサービスの運用を楽にする方法
PDF
【NGINXセミナー】 NGINXのWAFとは?その使い方と設定方法 解説セミナー
PDF
【NGINXセミナー】API ゲートウェイとしてのNGINX Plus活用方法
PPTX
Get Hands-On with NGINX and QUIC+HTTP/3
PPTX
Managing Kubernetes Cost and Performance with NGINX & Kubecost
PDF
Manage Microservices Chaos and Complexity with Observability
PDF
Accelerate Microservices Deployments with Automation
PDF
Unit 2: Microservices Secrets Management 101
PDF
Unit 1: Apply the Twelve-Factor App to Microservices Architectures
PDF
NGINX基本セミナー(セキュリティ編)~NGINXでセキュアなプラットフォームを実現する方法!
PDF
Easily View, Manage, and Scale Your App Security with F5 NGINX
PDF
NGINXセミナー(基本編)~いまさら聞けないNGINXコンフィグなど基本がわかる!
PDF
Keep Ahead of Evolving Cyberattacks with OPSWAT and F5 NGINX
PPTX
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
PPTX
Protecting Apps from Hacks in Kubernetes with NGINX
PPTX
NGINX Kubernetes API
PPTX
Successfully Implement Your API Strategy with NGINX
PPTX
Installing and Configuring NGINX Open Source
PPTX
Shift Left for More Secure Apps with F5 NGINX
PPTX
How to Avoid the Top 5 NGINX Configuration Mistakes.pptx
【NGINXセミナー】 Ingressを使ってマイクロサービスの運用を楽にする方法
【NGINXセミナー】 NGINXのWAFとは?その使い方と設定方法 解説セミナー
【NGINXセミナー】API ゲートウェイとしてのNGINX Plus活用方法
Get Hands-On with NGINX and QUIC+HTTP/3
Managing Kubernetes Cost and Performance with NGINX & Kubecost
Manage Microservices Chaos and Complexity with Observability
Accelerate Microservices Deployments with Automation
Unit 2: Microservices Secrets Management 101
Unit 1: Apply the Twelve-Factor App to Microservices Architectures
NGINX基本セミナー(セキュリティ編)~NGINXでセキュアなプラットフォームを実現する方法!
Easily View, Manage, and Scale Your App Security with F5 NGINX
NGINXセミナー(基本編)~いまさら聞けないNGINXコンフィグなど基本がわかる!
Keep Ahead of Evolving Cyberattacks with OPSWAT and F5 NGINX
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
Protecting Apps from Hacks in Kubernetes with NGINX
NGINX Kubernetes API
Successfully Implement Your API Strategy with NGINX
Installing and Configuring NGINX Open Source
Shift Left for More Secure Apps with F5 NGINX
How to Avoid the Top 5 NGINX Configuration Mistakes.pptx

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPT
Introduction Database Management System for Course Database
PDF
System and Network Administration Chapter 2
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
assetexplorer- product-overview - presentation
PPTX
ai tools demonstartion for schools and inter college
PDF
System and Network Administraation Chapter 3
PPTX
Transform Your Business with a Software ERP System
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PTS Company Brochure 2025 (1).pdf.......
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Introduction Database Management System for Course Database
System and Network Administration Chapter 2
Designing Intelligence for the Shop Floor.pdf
Reimagine Home Health with the Power of Agentic AI​
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
VVF-Customer-Presentation2025-Ver1.9.pptx
assetexplorer- product-overview - presentation
ai tools demonstartion for schools and inter college
System and Network Administraation Chapter 3
Transform Your Business with a Software ERP System
Design an Analysis of Algorithms II-SECS-1021-03
Design an Analysis of Algorithms I-SECS-1021-03
Odoo Companies in India – Driving Business Transformation.pdf
Digital Systems & Binary Numbers (comprehensive )
wealthsignaloriginal-com-DS-text-... (1).pdf
How to Migrate SBCGlobal Email to Yahoo Easily
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

Rate Limiting with NGINX and NGINX Plus

Editor's Notes

  • #6: Section divider / black
  • #12: Diagram / bullets
  • #14: Pretty straight forward, you append the burst and no delay feature to the limit_req_zone directive.
  • #15: Section divider / black
  • #17: You can change the error status code sent to the client when the number of requests exceed the request rate. The code value must be set between 400 and 599.
  • #18: Section divider / black
  • #20: Explain
  • #21: Commands for demo: docker build -t sportebois/nginx-rate-limit-sandbox-auto . docker run --rm -it -p 80 sportebois/nginx-rate-limit-sandbox-auto Terminal command to show network settings of docker container: docker inspect --format='{{json .NetworkSettings.Networks}}' container-name Look at the default gateway ip address (That is the ip address you want to use when you are whitelisting)
  • #22: What is the point of using geo + map directive, why don’t we just use the geo block ? In a simple use case presented in this blog, you can use the geo block to impose rate limits on http requests. The benefit of using the geo + map block is if you want to create an additional variable that gets mapped to the first parameter in the geo block. For example, say you have the following geo block: geo $country { 192.168.23.10/24 CA 10.10.2.9/18 UK 172.45.67.66/20 US } Say you don’t want to use $country as the request zone key. You want to use $limit_key which can be mapped to $country, while using $country for another use like conditional logic.
  • #23: If you enjoyed what you have just learned in this webinar, start a 30 day trial of NGINX Plus to start using many great exclusive features. NGINX Plus is a complete application delivery controller that offers advanced HTTP, TCP, and UDP load balancing beyond rate limiting such as session persistence, on-the-fly reconfiguration of load-balancing server groups, advanced cache control, and application health checking just to name a few. NGINX Plus also provides detailed live activity monitoring dashboard to increase application visibility and monitoring. Make sure to click the link on the slide and download it for free today, it takes two seconds. So do that right now and I will see you soon.