添加 limit/limit.md
This commit is contained in:
28
limit/limit.md
Normal file
28
limit/limit.md
Normal file
@@ -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;
|
||||||
|
...
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user