Original configuration: http { ...... limit_conn_zone $binary_remote_addr zone=one:10m; limit_req_zone $binary_remote_addr zone=fifa:10m rate=5r/s; ...... server { ...... limit_conn one 5; limit_req zone=fifa burst=100; ...... }} Whitelist configuration: http { ...... geo$whiteiplist { default 1; 127.0.0.1 0; 10.10.0.0/24 0; } map $whiteiplist $limit { 1 $binary_remote_addr; 0 ""; } limit_conn_zone $limit zone=one:10m; limit_req_zone $limit zone=fifa:10m rate=5r/s; ...... server { ...... limit_conn one 5; limit_req zone=fifa burst=100; ...... }} illustrate: The geo directive defines a whitelist $whiteiplist, the default value is 1, and all are restricted. If the client IP matches the IP listed in the whitelist, the $whiteiplist value is 0, which means no restriction. The map instruction maps the $whiteiplist value to 1, that is, the restricted IP, to the client IP. Map the $whiteiplist value of 0, that is, the whitelist IP, to an empty string. Limit_conn_zone and limit_req_zone directives with empty keys will be ignored, so there is no limit on the listed IPs. The above example of Nginx setting whitelist through geo module is all I want to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: JS realizes simple picture carousel effect
>>: Mysql solution to improve the efficiency of copying large data tables
Table of contents Install Docker-ce for the devel...
Introduction to Selenium Grid Although some new f...
This article collects the fonts used in the logos...
symptom I set a crontab task on a centos7 host, b...
Why is the title of the article “Imitation Magnif...
Introduction: Nginx (pronounced the same as engin...
Table of contents Development Environment Game en...
Preface I recently installed MySQL 5.7 and found ...
Method 1: SET GLOBAL general_log = 'OFF';...
Preface I don't know how long this friend has...
This article shares the specific code of js to re...
Vue version, copy it to the file and use it <t...
Table of contents 1. Resource download 2. Unzip t...
Detailed Analysis of Iframe Usage <iframe frame...
Purpose of using Nginx Using Alibaba Cloud ECS cl...