PortGate

Blueprints · Reverse Proxy & SSL

Production 15 min · Nginx

Nginx login rate limit

Stages a request limit for login paths. It does not block SSH.

Live config

Baked-in protections

Step 1 · conf

Limit zone

/root/portgate-blueprints/login-limit.conf

Include the zone in http and the location in the server that serves the login form.

limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
location = /login {
    limit_req zone=login burst=10 nodelay;
}

Step 2 · bash

Read-only check

/root/portgate-blueprints/nginx-limit-check.sh

Prints status. It does not change the service.

#!/bin/sh
set -eu
nginx -t 2>&1 || echo "nginx -t failed or nginx is not installed. The snippet was not loaded."