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

How to install and configure GitLab on Ubuntu 20.04

introduce GitLab CE or Community Edition is an op...

How to import Chinese data into csv in Navicat for SQLite

This article shares with you the specific method ...

Vue implements pull-down to load more

Developers familiar with Element-UI may have had ...

MySQL uses UNIQUE to implement non-duplicate data insertion

SQL UNIQUE constraint The UNIQUE constraint uniqu...

Detailed explanation of using Vue.prototype in Vue

Table of contents 1. Basic Example 2. Set the sco...

WEB standard web page structure

Whether it is the background image or the text siz...

Detailed explanation of Linux rpm and yum commands and usage

RPM package management A packaging and installati...

Example code for implementing a simple search engine with MySQL

Table of contents Preface Introduction ngram full...

Why can't the MP4 format video embedded in HTML be played?

The following code is in my test.html. The video c...

Learn Node.js from scratch

Table of contents url module 1.parse method 2. fo...

How to view files in Docker image

How to view files in a docker image 1. If it is a...

How to install nginx in docker and configure access via https

1. Download the latest nginx docker image $ docke...

Implementation of Docker CPU Limit

1. --cpu=<value> 1) Specify how much availa...