nginx.conf (700B)
1 events {} 2 3 http { 4 limit_req_zone $limit_key zone=unauth:10m rate=5r/s; 5 6 map $remote_user $limit_key { 7 default $binary_remote_addr; # No valid user -> rate limit by IP 8 "" $binary_remote_addr; # Explicit empty 9 ~^. ""; # Any non-empty $remote_user -> skip limit 10 } 11 12 server { 13 server_name example.com; 14 15 auth_basic "Restricted Area"; 16 auth_basic_user_file /etc/nginx/.htpasswd; 17 18 limit_req zone=unauth burst=10 nodelay; 19 limit_req_status 429; 20 21 location / { 22 proxy_pass http://127.0.0.1:4090; 23 } 24 25 location /guacamole { 26 proxy_pass http://127.0.0.1:8080/guacamole; 27 } 28 29 listen 80; 30 } 31 }