How to configure nginx to limit the access frequency of the same IP

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. Add the following code to the server{} configuration of the website that needs to limit the number of concurrent connections and download bandwidth:

limit_conn perip 2;

limit_conn perserver 20;

limit_rate 100k;

Supplementary explanation of the following parameters:

$binary_remote_addr is to limit the same client IP address;

$server_name is used 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 nginx configuration method to limit the access frequency of the same IP is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Implementation of Nginx configuration of multi-port and multi-domain name access
  • Solve the problem of modifying configuration access of tp5 under nginx
  • Steps to configure nginx ssl to implement https access (suitable for novices)
  • How to configure Nginx to distinguish between PC or mobile phone access to different domain names
  • Detailed explanation of Nginx access restriction configuration
  • Detailed explanation of nginx using ssl module configuration to support HTTPS access
  • How to use nginx to configure access to wgcloud

<<:  React native realizes the monitoring gesture up and down pull effect

>>:  MySQL FAQ series: How to avoid a sudden increase in the size of the ibdata1 file

Recommend

Vue + element to dynamically display background data to options

need: Implement dynamic display of option values ...

Implementation of postcss-pxtorem mobile adaptation

Execute the command to install the plugin postcss...

How to modify the user and group of a file in Linux

In Linux, when a file is created, the owner of th...

How to deploy LNMP architecture in docker

Environmental requirements: IP hostname 192.168.1...

...

Sample code for implementing markdown automatic numbering with pure CSS

The origin of the problem The first time I paid a...

JavaScript to achieve mouse drag effect

This article shares the specific code of JavaScri...

Detailed steps to deploy SpringBoot projects using Docker in Idea

Preface Project requirements: Install the Docker ...

MySQL 8.0.21 installation steps and problem solutions

Download the official website First go to the off...

Implementation of css transform page turning animation record

Page turning problem scenario B and C are on the ...

Detailed explanation of JavaScript's Set data structure

Table of contents 1. What is Set 2. Set Construct...

Introduction and use of Javascript generator

What is a generator? A generator is some code tha...

WeChat applet records user movement trajectory

Table of contents Add Configuration json configur...