From 9dfbe66673f27e9434b54c7a5d08e35a7fa92682 Mon Sep 17 00:00:00 2001 From: wwya Date: Mon, 30 Mar 2026 20:25:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20limit/limit.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- limit/limit.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 limit/limit.md 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