Skip to content
Skip the docs menu

Guide

Fix "502 Bad Gateway" after an update

Your site shows 502 Bad Gateway after an update. Put the working version back first, then find out why the app does not answer and fix it.

Last updated 2 min read5 stepsView as Markdown

What you will end up with

Your address opens normally again, and the next update is Published with every step done.

Go to the first step
On this page

"502 Bad Gateway" means the web server is running but the app behind it did not answer. After an update it usually means the new version does not start, or PHP stopped. This guide gets your site back first, then finds the cause.

What you need#

  • Access to the site in Fuzops (a role that may publish updates).

Steps#

  1. Put the working version back. Open the site's Updates tab, open the latest update and choose Go back to the previous version. Visitors see the version that worked again. If the update failed by itself, Fuzops may already have switched back: the update page says so.

    The Updates tab of a site with its historyThe Updates tab of a site with its history
  2. Read what went wrong. Open the failed update. Stopped at names the step, and See what went wrong explains it with What to do.

    A failed update that stopped at Restart the app and was switched backA failed update that stopped at Restart the app and was switched back
  3. Look at the logs. Open Monitoring & logs › Logs, choose Last 1 hour and Show me what went wrong. Look for the error your app printed when it started.

  4. Check the usual causes. The site's Settings › Limits and easy fixes › Fix a common error lists the three kinds of 502 and marks the ones seen in today's logs:

    • The app sent headers or cookies too large for the web server (the logs say "upstream sent too big header"): turn on My app sends large headers or cookies in one click.
    • Every PHP worker was busy (the PHP log says "max_children"): the server's Recommended settings shows how many workers fit in its memory. Apply it if more fit; if not, the slow pages or a server with more memory are the fix.
    • PHP or the app was not running: restart PHP from the server's Services. For a Node.js, Python or Go app, start it again and read its log: it usually crashed on start (a missing setting in the Environment, a missing package).
    • Out of memory: the server's Logs show out-of-memory messages, and Monitoring shows memory at its limit. Recommended settings shows how the memory is shared and adds spare memory on disk on small servers.
    Fix a common error: each error with what it means and the one-click fixFix a common error: each error with what it means and the one-click fix
  5. Fix and publish again. Fix the cause in your code or settings, then choose Publish update. Keep the After-update check on, so a version that does not answer is switched back by itself.

What you should see#

Your address opens normally again, and the next update is Published with every step done.

If it goes wrong#

  • Going back did not help: the problem is not in the new code. Restart the app or PHP from the server's Services, and check the server's Monitoring for a full disk or memory.
  • The whole server is not responding: see Troubleshooting.
  • 504 instead of 502: the page took longer than allowed. See Fix 504 Gateway Timeout.

Still stuck? Get help

Docs menu