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
If the field storing the name uses the GBK charac...
I love coding, it makes me happy! Hello everyone,...
To understand what this means, we must first know ...
First create a directory cd /etc/nginx mkdir ssl ...
Because frameset and body are on the same level, y...
Preface I need to add a synchronized scrolling fe...
This article shares the specific code of JavaScri...
text 1) Download the Ubuntu image docker pull ubu...
<br />This site’s original content, please i...
After installing the database, if you accidentall...
This article shares the specific code of Vue+expr...
Table of contents 1. v-on directive 1. Basic usag...
The content involved in Web front-end development...
【1】<i></i> and <em></em> ...
Table of contents npm Install the loader Import P...