1.
http { #定义区域:one、two 限制rate 1r/s频率每秒1次 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; limit_req_zone $http_token zone=two:10m rate=1r/s; server { listen 8080 default_server; server_name localhost; location ~ .* { proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:8080; } location ^~ /interface { #limit_req zone=one burst=5 nodelay; if ($http_token="") { return 403; } limit_req zone=two burst=5 nodelay; proxy_pass http://127.0.0.1:8080; } } }
时间: 2024-11-06 11:32:28