NGINX Limiting the Request Rate

Quick manual how to setup the most useful features of NGINX - rate limiting.

You need edit your nginx config in http and each server sections.

add two strings below to the http section:


http {
	...
	limit_conn_zone $binary_remote_addr zone=connections:45m;
	limit_req_zone $binary_remote_addr zone=requests:80m rate=70r/s;
	...
}

and add another two strings below to the server section:


server {
	...
	limit_conn connections 128;
	limit_req zone=requests burst=128;
	...
}

This changes will be enough to protect your site against of DDoS attack. For fine tuning read Nginx documentation

Articles

Visit our blog

On sale