0
Answered

http limit_req_zone

CreativeWolf 9 year бұрын updated by anonymous 9 year бұрын 4
Hi,

I'm trying to figure how to add a http block with the following for rate limit.

http {
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
}

Tried adding this in /etc/nginx.custom.d/codes.conf - Doesn't work.

Please suggest.

CW

Answer

Answer
Answered
Just paste this line only (limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;) in your nginx.custom.d/limits.conf file.


See the include directives in /etc/nginx/nginx.conf for more info.
GOOD, I'M SATISFIED
Awesome. That worked like a charm!
Satisfaction mark by CreativeWolf 9 year бұрын
Answer
Answered
Just paste this line only (limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;) in your nginx.custom.d/limits.conf file.


See the include directives in /etc/nginx/nginx.conf for more info.
Thank you.

I just did that and added this directive (limit_req zone=one burst=5 nodelay;) in Advanced under Content section.
Upon restarting nginx I get the following error:
2015/08/05 15:42:18 [emerg] 26250#0: unknown limit_req_zone "one" in /etc/nginx/conf.d/mydomain.conf:31

Thoughts please?

Hmm looks like it's relying on zone being defined before being used. In this case, remove your nginx.custom.d file and instead paste the zone definition into Website > Advanced > Custom top-level configuration.
Thanks, that worked like a charm! You rock Eugene! :)

Cheers

CreativeWolf