1. Overview of modules and instructions used to limit access frequency, concurrent connections, and download speed
Leaky bucket algorithm The algorithm idea is:
2. Limit URL access request frequency http{ ... limit_req_zone $binary_remote_addr zone=one:30m rate=20r/s; limit_req_zone $binary_remote_addr $uri zone=two:30m rate=20r/s; limit_req_zone $binary_remote_addr $request_uri zone=three:30m rate=20r/s; limit_req_status 444; ... server{ ... limit_req zone=two burst=15 nodelay; ... } } explain: limit_req_zone $binary_remote_addr zone=one:30m rate=20r/s;
limit_req_zone $binary_remote_addr $uri zone=two:30m rate=20r/s;
limit_req_zone $binary_remote_addr $request_uri zone=three:30m rate=20r/s;
limit_req zone=two burst=15 nodelay;
3. Concurrent connection limit Case 1: http { ... limit_conn_log_level error; limit_conn_zone $binary_remote_addr zone=addr:10m; limit_conn_status 503; ... server { ... location /download/ { limit_conn addr 1; the single client IP is limited to 1 } ... } Case 2: http{ limit_conn_zone $binary_remote_addr zone=perip:10m; limit_conn_zone $server_name zone=perserver:10m; server { ... limit_conn perip 10; #Number of connections between a single client IP and the server limit_conn perserver 100; #Limit the total number of connections to the server} } 4. Limit download speed location /download { limit_rate 128k; } #If you want to set the user to download the first 10m of the file without speed limit, and limit the speed to 128kb/s after it exceeds 10m, you can add the following content location /download { limit_rate_after 10m; limit_rate 128k; } The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of mysql execution plan id is empty (UNION keyword)
>>: How to use Axios asynchronous request API in Vue
A set of MySQL libraries for testing. The previou...
Set a background image for the table. You can use...
Problem: vue-cil3 runs with warnings potentially ...
The Docker Hub we used earlier is provided by Doc...
Table of contents Event Loop miscroTask (microtas...
css3 background image related Compatibility: IE9+...
Table of contents Preface How does antd encapsula...
This article uses examples to illustrate the MySQ...
MySQL 5.7.17 installation and configuration metho...
We know that there are two ways to receive incomi...
This article shares the specific code of JavaScri...
1. Create a shell script vim backupdb.sh Create t...
Friends who are learning HTML, CSS and JS front-e...
The form elements with visibility=hidden and displ...
Preface Today I installed MySQL and found that th...