502 Bad Gateway error

I reinstalled ghost (latest version) on my vps (ubuntu) and when I launched the website it worked.
But sometimes (1 in 5) it just showed 502 Bad Gateway error.
Does someone have a way to fix? Thanks in advance!

What are your Ghost server logs saying? A Bad Gateway is usually a communication issue between Ghost and Nginx (assuming you are using Nginx).

From the behaviour you’re describing it sounds like Ghost is starting, then crashes, and starts again. So, would be interesting to see what the logs say about that.

also worth checking your DNS entries. Do you perhaps have duplicate records, and so it’s random whether you get the right one?