Introduction The module that limits the number of concurrent connections is: http_limit_conn_module, address: http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html The module that limits the number of concurrent requests is: http_limit_req_module, address: http://nginx.org/en/docs/http/ngx_http_limit_req_module.html Both modules are compiled into Nginx by default. Limit the number of concurrent connections Example configuration: http { limit_conn_zone $binary_remote_addr zone=addr:10m; #limit_conn_zone $server_name zone=perserver:10m; server { limit_conn addr 1; limit_conn_log_level warn; limit_conn_status 503; } } limit_conn_zone key zone=name:size; defines the configuration of concurrent connections
limit_conn zone number; concurrent connection limit
limit_conn_log_level info | notice | warn | error ; Log level when limit occurs
limit_conn_status code; the error code returned when a limit occurs, the default is 503
Limit the number of concurrent requests limit_req_zone key zone=name:size rate=rate; Defines the configuration for limiting concurrent requests.
limit_req zone=name [burst=number] [nodelay | delay=number];
limit_req_log_level info | notice | warn | error; Log level when limit occurs
limit_req_status code ; error code when a limit occurs
Example Configuration 1 http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; limit_req zone=one burst=5; } The request rate is 1 request delivered per second. The burst bucket size can store 5 requests. Requests exceeding the limit will return an error. Example Configuration 2 http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; limit_req zone=one burst=5 nodelay; } Example configuration 2 adds the Example Configuration 3 http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; limit_req zone=one burst=5 delay=3; } Example configuration 3 adds This is the end of this article about how to limit the number of concurrent connection requests in nginx. For more information about how to limit the number of concurrent connection requests in nginx, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Summary of common Mysql DDL operations
>>: Commonly used JavaScript array methods
1. Who is tomcat? 2. What can tomcat do? Tomcat i...
Preface Query optimization is not something that ...
Using win docker-desktop, I want to connect to co...
Introduction to Git Git is an open source version...
<br />Original: Understanding Progressive En...
reason The mysql version that nacos's pom dep...
Redis uses the apline (Alps) image of Redis versi...
This article shares the specific code of vue+swip...
background A colleague is working on his security...
Experimental environment Apache and Tomcat are bo...
This article introduces the development environme...
Preface Linux has corresponding open source tools...
The LIKE operator is used in the WHERE clause to ...
Table of contents 1. v-on directive 1. Basic usag...
This article records the installation tutorial of...