Home > Article > Operation and Maintenance > How to configure nginx to limit the access frequency of the same IP
1. Add the following code to http{} in nginx.conf:
limit_conn_zone $binary_remote_addr zone=perip:10m; limit_conn_zone $server_name zone=perserver:10m;
2. Configure server{ on websites that need to limit the number of concurrencies and download bandwidth. } Add the following code:
limit_conn perip 2; limit_conn perserver 20; limit_rate 100k;
Additional explanation of the parameters:
$binary_remote_addr is to limit the same client ip address;
$ server_name is to limit the maximum number of concurrent connections on the same server;
limit_conn is to limit the number of concurrent connections;
limit_rate is to limit the download speed;
The above is the detailed content of How to configure nginx to limit the access frequency of the same IP. For more information, please follow other related articles on the PHP Chinese website!