NGINX Rate Limit Generator
Configure limit_req_zone and limit_req in NGINX to rate limit per IP. Includes configurable burst and nodelay.
—
Rate limiting in nginx without shutting out real users
nginx rate limiting works in two parts that live in different places in the file, and that is exactly where the configuration tends to fail. The directive defining the shared zone goes in the http block; the one applying the limit goes in server or location. Defining the zone and forgetting to apply it results in no limit at all — with no error whatsoever.
Fill in the zone name, the memory size, the rate and the burst and the page assembles both lines, each marked with where it belongs. The zone size is shared memory holding per-key state: one megabyte holds on the order of sixteen thousand addresses, so ten megabytes comfortably cover most sites.
The part that confuses most is the burst and nodelay pair. nginx uses a leaky bucket: the rate is constant and the burst is how much excess may queue. Without nodelay, excess requests are delayed until they fit the rate — the client waits. With nodelay, they pass immediately, as long as they fit within the burst. For human browsing, nodelay is usually right, because one page fires several requests at once and delaying them makes the site slow for no reason.
Frequently asked questions
Which key should I limit on?
What happens when the limit is exceeded?
Does this protect against a denial-of-service attack?
Related Tools
.htpasswd Generator
Generate .htpasswd lines for Apache/Nginx basic auth. Supports MD5 (apr1), SHA1 and bcrypt hashes. Paste the result straight into the file. Everything in your browser.
NGINX server block Generator
Build an NGINX server block: server_name, listen, root, index, location / try_files, gzip and logs. Starter config ready.
NGINX Reverse Proxy Generator
Build an NGINX reverse proxy with backend upstream, default proxy_set_header (Host, X-Real-IP, X-Forwarded-*) and WebSocket support.
Shell Argument Escaper
Quote a string safely for bash/sh, wrapping in single quotes and handling embedded quotes.
JavaScript Minifier
Minify JavaScript code by removing whitespace and comments to reduce file size in production.
Storybook main.js Generator
Generate the .storybook/main.js for Storybook 7+ with React and Vite, ready to use. Copy the config and start documenting your components in minutes.