diff --git a/limit/limit.md b/limit/limit.md new file mode 100644 index 0000000..0aada00 --- /dev/null +++ b/limit/limit.md @@ -0,0 +1,28 @@ + +## nginx.conf +```shell + limit_req_zone $binary_remote_addr zone=req_limit_zone:10m rate=10r/s; + limit_conn_zone $binary_remote_addr zone=conn_limit_zone:10m; + limit_req_status 429; + limit_conn_status 429; +``` + +## limit.conf +```shell + limit_req zone=req_limit_zone burst=100 nodelay; + + location = /robots.txt { + default_type text/plain; + return 200 "User-agent: *\nDisallow:\n"; + } + +``` + +## server.conf +``` +server { + ... + include limit.conf; + ... + +} \ No newline at end of file