Nginx issue, when i am stop and starting the app getting "502 Bad Gateway"

tbh that’s not too far out of the ordinary rebuilds aren’t fast, especially when…

…you don’t have a lot of memory.

Generally, at least 4GB of total memory (ram and swap) is recommended for Discourse these days.