Ajout d'une section Limiter le taux de requêtes par IP
This commit is contained in:
parent
f8794e578e
commit
52e0c85a08
|
@ -572,6 +572,27 @@ EOT
|
||||||
# systemctl restart nginx
|
# systemctl restart nginx
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
### Limiter le taux de requêtes par IP
|
||||||
|
|
||||||
|
On peut définir un « taux » maximum de connexions par IP, ainsi qu'une queue pour les requêtes qui dépassent cette limite.
|
||||||
|
|
||||||
|
Doc : [https://www.nginx.com/blog/rate-limiting-nginx/](https://www.nginx.com/blog/rate-limiting-nginx/)
|
||||||
|
|
||||||
|
Ajouter dans `/etc/nginx/conf.d/zzz-evolinux-custom.conf` :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
# Define the parameters for rate limitation (10Mo cache memory, max 1 request/100ms for an IP)
|
||||||
|
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Ajouter dans le bloc `server` des vhosts concernés :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
# Define the rate limit, queue up the resquests to 20 if the rate limit is exceeded, nodelay answers immediatement the requests in the rate limit
|
||||||
|
limit_req zone=mylimit burst=20 nodelay;
|
||||||
|
~~~
|
||||||
|
|
||||||
|
|
||||||
## SSL
|
## SSL
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
|
|
Loading…
Reference in a new issue