502 gateway errors typically come from the proxy service (such as nginx) and it means it’s unable to contact the backend service (Strapi).
I would suggest you check your server logs as it’s likely the Strapi application crashed with an internal error. If you are using the one-click, you can find documentation on how to access the Strapi service user and the pm2 logs: https://strapi.io/documentation/developer-docs/latest/installation/digitalocean-one-click.html#using-the-service-account