Home >Backend Development >PHP Tutorial >nginx whitelist configuration beyond limiting the number of connections and requests nginx apache nginx php nginx rewrite

nginx whitelist configuration beyond limiting the number of connections and requests nginx apache nginx php nginx rewrite

WBOY
WBOYOriginal
2016-07-29 08:54:511174browse

I have written two articles before to introduce nginx_http_limit_req_module and nginx_http_limit_conn_module, which respectively limit the number of user requests and connections. The whitelist is mainly to divide some internal personnel so that they are not affected by the restrictions.

You can read the previous article first:
nginx limits the number of requests
http://blog.csdn.net/wanglei_storage/article/details/51076882
nginx limits the number of connections
http://blog.csdn.net/wanglei_storage/article/details/51076561


Module View:

tening After compilation and installation, use sbin/nginx -V to view all modules, and whitelist configuration is required geo module support.

nginx 配置,nginx 安装,nginx下载,nginx windows,nginx负载均衡配置,nginx 重启,nginx apache,nginx php,nginx rewrite


1. geo command

Syntax: geo $variable {……}
Default value: none
Configuration section: http

Parameter introduction:
default: nginx will use this value if the client address cannot match any of the defined addresses. If CIDR is used, "0.0.0.0/0" can be used instead of default.

ranges: Define the address in the form of an address segment. This parameter must be placed first. To speed up loading of the address library, addresses should be defined in ascending order.


2. Configuration usage example:

1) Limit the number of requests
limit_req_zone: used to define the limit request zone; includes client address, zone name, shared memory, and rate.

2) Limit the number of connections
limit_conn_zone: used to define a restricted connection area; includes area name and shared memory.

3) geo mainly defines the whitelist configuration, the variable is $white_ip, and the parameters and specific values ​​are defined in { }.

Use limit_req_whitelist at the bottom to apply the configured whitelist, 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; all IPs in the whitelist are not subject to any restrictions.

nginx 配置,nginx 安装,nginx下载,nginx windows,nginx负载均衡配置,nginx 重启,nginx apache,nginx php,nginx rewrite

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the whitelist configuration of nginx other than limiting the number of connections and requests, including nginx content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn