Is there a step by step diagnostic for when a Discourse site is found in a 502 Bad Gateway?

502 happens when rails doesn’t return a response, usually when the system is booting up or something is misconfigured.

You might look in the nginx logs