Experiencing 502 Bad Gateway

What issue or error are you experiencing?

I am experiencing 502 Bad Gateway error on one site only out of all my Local sites.

I tried by deactivating all plugins (via WP-CLI) and restarted the site but the error remains.

Within the nginx > error.log, I keep seeing “upstream prematurely closed connection while reading response header from upstream” but I have no idea how to resolve this.

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

I turned on this site on Local after few dormant months and received this message.

System Details

  • Local Version:
    Version 9.0.2+6676

  • Operating System (OS) and OS version:
    macOS 13.6.6 (22G630)

Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)
local-logs.zip (58.3 KB)

Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hi @billielaw119

What about swapping out the theme on the site via CLI? Does that bring it back up?

What about cloning or exporting and reimporting it?

It sounds like opening the site might be causing some type of memory leak or timeout issue. You might run through our performance guide here and see if any of these other common culprits could apply.

1 Like

Hi @Nick-B, thanks for your suggestion! It did help me narrow down the issue and it stemmed from a function within my functions.php. Can consider this ticket closed!


Hi @billielaw119 -

Wonderful! Thank you for letting us know what worked.

Happy building :green_heart:


This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.