Преглед на файлове

Add whitelisting logic for nginx to docs

Philipp Heckel преди 3 години
родител
ревизия
ed4cc86c5c
променени са 1 файла, в които са добавени 16 реда и са изтрити 0 реда
  1. 16 0
      docs/config.md

+ 16 - 0
docs/config.md

@@ -805,9 +805,25 @@ and [here](https://easyengine.io/tutorials/nginx/block-wp-login-php-bruteforce-a
 
 === "/etc/nginx/nginx.conf"
     ```
+    # Rate limit all IP addresses
     http {
 	  limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
     }
+
+    # Alternatively, whitelist certain IP addresses
+    http {
+      geo $limited {
+        default 1;
+        116.203.112.46/32 0;
+        132.226.42.65/32 0;
+        ...
+      }
+      map $limited $limitkey {
+        1 $binary_remote_addr;
+        0 "";
+      }
+      limit_req_zone $limitkey zone=one:10m rate=1r/s;
+    }
     ```
 
 === "/etc/nginx/sites-enabled/ntfy.sh"