Skip to content

Instantly share code, notes, and snippets.

@roktas
Last active April 6, 2019 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roktas/d0933086ca108a0b66a5b33d3e66cdcd to your computer and use it in GitHub Desktop.
Save roktas/d0933086ca108a0b66a5b33d3e66cdcd to your computer and use it in GitHub Desktop.
http {
# Each unique IP address will be limited to 10 requests per second.
# They cannot make a request for that URL within 100 milliseconds of its previous one.
limit_req_zone $binary_remote_addr zone=limit_req:10m rate=10r/s;
# Limit a single IP address to make no more than 100 connections within 1 minute.
limit_conn_zone $binary_remote_addr zone=limit_conn:1m;
limit_conn limit_conn 100;
server {
location /login/ { # FIXME
# Any request that arrives sooner than 100 milliseconds after the previous
# one is put in a queue with a size of 20.
limit_req zone=limit_req burst=20 nodelay;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment