NGINX request limiting can reduce repeated HTTP work at a chosen endpoint. It cannot recover an upstream link already saturated, and a rule can reject legitimate clients. Start in observation mode, verify the client identity used by the rule and retain a rollback configuration.
This workflow is for an authorized operator of an existing NGINX HTTP service. It is not a complete DDoS mitigation system or a tested configuration for your application. For service coverage, use the DDoS selection guide.
Establish the endpoint and recovery path
Choose one expensive or abuse-prone endpoint and document legitimate request patterns, including integrations and shared networks. Save the active configuration and confirm administrative access. Check the installed version and available modules before using directives from a newer manual.
nginx -v
nginx -V
nginx -t
The NGINX command-line reference documents these checks. Run configuration checks with the permissions your installation requires. A syntax check does not establish correct routing or acceptable client behavior.
Choose a trustworthy counting key
An address-based limit behind a proxy may count the proxy rather than the visitor. The real-IP module supports replacement addresses from explicitly trusted sources. Configure only the known proxy ranges and header mechanism for your deployment; trusting arbitrary incoming forwarding headers lets clients influence the identity being counted. Verify logs from representative clients before proceeding.
Observe a narrow request limit
The following illustrative values are for a controlled test, not recommended production thresholds. Define the zone inside the existing http context, and add the location directives to the already configured location you are evaluating. Do not replace its existing application handler or create a new location that changes routing.
# Inside http:
limit_req_zone $binary_remote_addr zone=endpoint_check:10m rate=2r/s;
# Inside the existing selected location:
limit_req zone=endpoint_check burst=4;
limit_req_dry_run on;
limit_req_status 429;
The request-limit module defines zone, burst and dry-run behavior. Dry run records excess requests without enforcing the limit; it requires a version supporting that directive. Include $limit_req_status in an appropriate access-log format to observe outcomes. Keep logs scoped and avoid recording credentials or sensitive request content.
Validate before enforcement
- Run
nginx -t; resolve errors before reloading. - Reload using your installation’s supported service procedure. Confirm the intended configuration is active.
- Exercise ordinary authorized client journeys at bounded rates. Include concurrent legitimate clients sharing an address and relevant automated integrations.
- Inspect dry-run outcomes and response behavior. Adjust the proposed scope and values to evidence, not a universal requests-per-second rule.
- Only then consider enforcement by disabling dry run in the reviewed scope. Watch errors and client complaints, and restore the saved configuration if needed.
NGINX configuration inheritance matters: inspect the effective configuration when a more specific location has its own limit directives. Keep an internal record of the chosen key, scope, observed legitimate load, decision and rollback method.
Keep other controls separate
Timeouts require application-aware choices. In the HTTP core documentation, the header timeout covers receiving the entire header, while the body timeout applies between successive reads. They are not interchangeable total-request deadlines. Aggressive values can break legitimate slow clients or uploads.
Caching requires correct private-content and freshness rules; it is not a blanket permission to cache authenticated responses. Connection limits, upstream filtering and application controls address different constraints. An event-driven server does not guarantee uninterrupted service under arbitrary traffic.
Record the result and remaining limits
A completed exercise establishes the behavior of the selected HTTP rule under the checks performed. It does not certify volumetric attack capacity. During an actual disruption, preserve evidence and follow the incident-response workflow. WebCare360’s service page is the commercial starting point; verify actual coverage with the responsible operator.


