Site responds 502 Bad gateway - is it Ruby?

Were you trying to change the domain name for your instance?

There are procedures in place for that. if you don’t undertake the process, it can cause errors such as the one you’re experiencing.

Please follow this guide, it will help you change the domain name properly.
Change the domain name or rename my Discourse?