Tengine Module Documentation: LIMIT_REQ module features

Source: Internet
Author: User
Keywords Limit_req module features module documentation
Tags binary default http info location multiple nginx notice

Ngx_http_limit_req_module

Instructions

Syntax:limit_req_log_level Info | Notice | Warn | Error
Default:limit_req_log_level warn
Context:http

Same as Nginx.

Syntax:limit_req_zone $session _variable1 $session _variable2 ... zone=name_of_zone:size rate=rate
Default:-
Context:http

Similar to Nginx, it supports multiple variables and supports multiple Limit_req_zone settings. Like what:

Limit_req_zone $binary _remote_addr zone=one:3m rate=1r/s; Limit_req_zone $binary _remote_addr $uri zone=two:3m rate=1r/s; Limit_req_zone $binary _remote_addr $uri $args zone=thre:3m rate=1r/s;

The second instruction above indicates that the same IP address and access to the same URI will result in the restriction of entering the limit req (1 requests per second).

Syntax:limit_req [on/off] | Zone=zone Burst=burst [forbid_action=action] [Nodelay]
Default:-
Context:http, Server, location

The use of Zone,burst and Nodelay is the same as in the Nginx limit req module.

The support switch is turned on by default. and a location supports multiple limit_req instructions, and when there are multiple limit_req instructions, the relationship between these instructions is or, that is, when any one of the restrictions is triggered, the corresponding limit_req is executed.

Forbid_action represents the action to be performed by Nginx when the condition is triggered, the name location and the page (/) are supported, and the default is to return 503. Like what:

Limit_req_zone $binary _remote_addr zone=one:3m rate=1r/s; Limit_req_zone $binary _remote_addr $uri zone=two:3m rate=1r/s; Limit_req_zone $binary _remote_addr $uri $args zone=three:3m rate=1r/s; Location/{limit_req zone=one burst=5; limit_req zone=two forbid_action= @test1; limit_req zone=three burst=3 forbid_ Action= @test2; Location/off {limit_req off;} location @test1 {rewrite ^/test1.html;} location @test2 {rewrite ^/test2.html;}

Syntax:limit_req_whitelist Geo_var_name=var_name Geo_var_value=var_value
Default:-
Context:http, Server, location

Represents the whitelist, which works with the Geo module, where geo_var_name represents the variable name set by the Geo module and Geo_var_value represents the variable value set by the GEO module. Like what:

Geo $white _ip {ranges; default 0; 127.0.0.1-127.0.0.255 1;} limit_req_whitelist geo_var_name=white_ip geo_var_value=1;

The above indicates that IP 127.0.0.1-127.0.0.255 this interval will skip limit_req processing.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.