NGINX 502 Bad Gateway | nginx reverse proxy 502 bad gateway
Editor’snote:Gunicornusestheterm“master”todescribeitsprimaryprocess.Datadogdoesnotusethisterm.Withinthisblogpost,wewillrefertothisas“primary,”exceptforthesakeofclarityininstanceswherewemustreferenceaspecificprocessname.ThispostispartofaseriesontroubleshootingNGINX502BadGatewayerrors.Ifyou’renotusingGunicorn,checkoutourotherarticleontroubleshootingNGINX502swithPHP-FPM[1]asabackend.Gunicorn[2]isapopularapplicationserverforPythonapplications.ItusestheWebServerGatewayInterface(WSGI)[3],whichdefi...
Editor’s note: Gunicorn uses the term “master” to describe its primary process. Datadog does not use this term. Within this blog post, we will refer to this as “primary,” except for the sake of clarity in instances where we must reference a specific process name.
This post is part of a series on troubleshooting NGINX 502 Bad Gateway errors. If you’re not using Gunicorn, check out our other article on troubleshooting NGINX 502s with PHP-FPM[1] as a backend.
Gunicorn[2] is a popular application server for Python applications. It uses the Web Server Gateway Interface (WSGI)[3], which defines how a web server communicates with and makes requests to a Python application. In production, Gunicorn is often deployed behind an NGINX web server. NGINX proxies web requests and passes them on to Gunicorn worker processes that execute the application.
NGINX will return a 502 Bad Gateway[4] error if it can’t successfully proxy a request to Gunicorn or if Gunicorn fails to respond...