What the message looks like
limiting requests, excess: 20.640 by zone "perip", client: 198.51.100.7, server: example.com, request: "GET /api/ HTTP/1.1"Common causes
limit_reqorlimit_connkicks in – nginx answers with 503 by default.- Application in maintenance mode, e.g. Nextcloud with
maintenance => true. - Load balancer (HAProxy, cloud LB) has no healthy backend server.
- PHP-FPM or app workers saturated, queue overflowing.
- Service not ready yet after an update or restart.
Check
- Check headers: Server and Retry-After show who answers
curl -sSI https://example.com/ | head -n 5 - Search error.log for rate limit hits
grep -E 'limiting (requests|connections)' /var/log/nginx/error.log | tail -n 5 - Find limits and fixed 503 responses in the config
nginx -T 2>/dev/null | grep -nE 'limit_req|limit_conn|return 503' - Show failed services
systemctl --failed
Fix
- For rate limits set
burstandnodelaysensibly and return the right code withlimit_req_status 429;. - End the application's maintenance mode, e.g.
occ maintenance:mode --off. - Check the load balancer health checks: path, port and expected status code.
- Match worker count to RAM and load, e.g.
pm.max_childrenfor PHP-FPM. - Restart the service and check the journal for why it was not ready.
Typical scenario
A page loads without some images for certain visitors, and the browser's network tab shows individual requests with '503 Service Temporarily Unavailable'. The nginx log says 'limiting requests, excess: 20.640 by zone perip'. The page has 60 assets, so a limit of ten requests per second with a small burst hits normal users. First confirm that the 503 comes from the rate limit by searching the log for exactly that line.
FAQ
What is the difference between 502 and 503?
502 means the backend answered invalidly or not at all. 503 means the service is temporarily unavailable on purpose or due to overload.
Does a 503 hurt Google rankings?
Not short term – 503 is meant for exactly this. If it lasts for days, Google drops pages from the index. Send a Retry-After header during maintenance.
Why does limit_req return 503 rather than 429?
The default of limit_req_status is 503. With limit_req_status 429; you signal more clearly to clients and monitoring that this is throttling and not a server outage.
How do I tell a rate-limit 503 from a real outage?
The rate-limit 503 shows 'limiting requests' in the error log, an outage shows messages such as 'no live upstreams'. The response headers help as well: a custom maintenance page or a load balancer often sets a different Server header.
How do I curb abuse without slowing real users?
Apply the limit only to costly paths such as login or search and exempt static files. With burst and nodelay, short spikes are allowed, and trusted addresses can be exempted with a geo map.