Nginx to limit the number of connections and requests in addition to the white list configuration nginx apache nginx php nginx rewrite

Source: Internet
Author: User
I have written two articles in front of the introduction of Nginx_http_limit_req_module and Nginx_http_limit_conn_module, respectively, the number of user requests and the number of connections to limit, and the white list is mainly to some internal personnel division, and thus unaffected by limitations.

Take a look at the previous article:
Nginx Limit number of requests
http://blog.csdn.net/wanglei_storage/article/details/51076882
Nginx Limit number of connections
http://blog.csdn.net/wanglei_storage/article/details/51076561

Module View:

Tening use Sbin/nginx-v to view all modules after the compilation installation is complete, and the whitelist configuration requires GEO module support.

I. GEO directives

Syntax: Geo $variable {...}
Default value: None
Configuration segment: http

Parameter description:
Default: Nginx will use this value if the client address does not match any of the defined addresses. If you use CIDR, you can use "0.0.0.0/0" instead of default.

Ranges: Use the address segment to define the address, this parameter must be in the first place. To speed up the loading of the address library, the address should be defined in ascending order.

Second, the configuration use example:

1) Limit the number of requests
Limit_req_zone: Used to define the limit request area, including the client address, zone name and shared memory, rate.

2) Limit the number of connections
Limit_conn_zone: Used to define restricted connection areas, including zone names and shared memory.

3) GEO is primarily defined as a whitelist configuration, where variables are defined as $white _ip,{} and define parameters and specific values.

At the bottom, the whitelist configured with the Limit_req_whitelist app is used, 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, and the IP in all white lists is not subject to any restrictions.

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the Nginx limit connection and the number of requests in addition to the white list configuration, including Nginx content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.