Skip to content

Instantly share code, notes, and snippets.

@thebongy
Created July 27, 2020 13:32
Show Gist options
  • Save thebongy/0d6b3dd05af365964c18c0b098014b0e to your computer and use it in GitHub Desktop.
Save thebongy/0d6b3dd05af365964c18c0b098014b0e to your computer and use it in GitHub Desktop.
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
limit_conn_zone $binary_remote_addr zone=addr:10m;
server {
server_name mydomain.com;
limit_req zone=mylimit burst=15;
limit_conn addr 10;
limit_req_status 429;
client_max_body_size 8M;
location / {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment