Glossary

502 Bad Gateway

What is a 502 Bad Gateway error?

In short

A 502 Bad Gateway error means the reverse proxy could not get a valid answer from the app behind it: the app is down, crashed or refused the connection.

Why it matters

The proxy itself is fine; look behind it. Common causes are a stopped PHP-FPM or Node process, a full worker pool, an app killed by the OOM killer, or a wrong upstream address after a deploy. A 504 is the same story, but the app answered too slowly rather than not at all.

How to check it on Linux

The proxy’s error log names the upstream that failed:

sudo tail -n 50 /var/log/nginx/error.log

What Opservo does about it

Opservo reads your nginx logs, groups repeated errors into patterns and explains them in plain English, and flags the service behind the proxy when it stops. Error library

502 Bad Gateway, answered

What is a 502 Bad Gateway error?+

A 502 Bad Gateway error means the reverse proxy could not get a valid answer from the app behind it: the app is down, crashed or refused the connection.

How do I check a 502 Bad Gateway error on Linux?+

The proxy’s error log names the upstream that failed: sudo tail -n 50 /var/log/nginx/error.log

How does Opservo handle a 502 Bad Gateway error?+

Opservo reads your nginx logs, groups repeated errors into patterns and explains them in plain English, and flags the service behind the proxy when it stops.

Related terms

Opservo watches all of this on every server and explains problems in plain English. Free for 2 servers.