Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Last active January 18, 2018 02:32
Show Gist options
  • Save StevenJL/f75a87dade15b671ab5bace0c37768e1 to your computer and use it in GitHub Desktop.
Save StevenJL/f75a87dade15b671ab5bace0c37768e1 to your computer and use it in GitHub Desktop.
http {
# The `limit_req_zone` directive here prevents a single ip
# address from making more than 30 requests per minute.
# The `$binary_remote_addr` tells nginx to use the remote address
# as the "key" for rate limiting. The zone is used to define a
# name and size where excessive requests are stored.
limit_req_zone $binary_remote_addr zone=my_zone:12m rate=30r/m;
location /do_not_dos_plz {
# `limit_req` can also be used to within `location` blocks
# using the `limit_req` directive.
limit_req zone=my_zone
}
}
# vi: ft=nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment