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

Nginx configuration and compatibility with HTTP implementation code analysis

Generate SSL Key and CSR file using OpenSSL To co...

Solution to ElementUI's this.$notify.close() call not working

Table of contents Requirement Description Problem...

In-depth explanation of the locking mechanism in MySQL

Preface In order to ensure the consistency and in...

3 ways to create JavaScript objects

Table of contents 1. Object literals 2. The new k...

In-depth analysis of the slow query problem of MySQL Sending data

Through an example, I shared with you the solutio...

Dynamically add tables in HTML_PowerNode Java Academy

Without further ado, I will post the code for you...

Summary of JS tips for creating or filling arrays of arbitrary length

Table of contents Preface Direct filling method f...

Tomcat uses thread pool to handle remote concurrent requests

By understanding how tomcat handles concurrent re...

15 Vim quick reference tables to help you increase your efficiency by N times

I started using Linux for development and enterta...

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

1. Add the following code to http{} in nginx.conf...

Detailed Analysis of the Selection of MySQL Common Index and Unique Index

Suppose a user management system where each perso...

Detailed explanation of common for loop in JavaScript statements

There are many loop statements in JavaScript, inc...

5 Commands to Use the Calculator in Linux Command Line

Hello everyone, I am Liang Xu. When using Linux, ...