Skip to content

Instantly share code, notes, and snippets.

@adamenger
Last active August 29, 2015 14:13
Show Gist options
  • Save adamenger/9958c394ae0ebbf2178b to your computer and use it in GitHub Desktop.
Save adamenger/9958c394ae0ebbf2178b to your computer and use it in GitHub Desktop.
limit_req_zone in nginx.conf
http {
... # your nginx.conf here
# Maps ip address to $limit variable if request is of type POST
map $request_method $limit {
default "";
POST $binary_remote_addr;
}
# Creates 10mb zone in memory for storing binary ips
limit_req_zone $limit zone=my_zone:10m rate=1r/s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment