Why does my site keep generating an Error 502?

A 502 error usually means that there is an issue with your origin server. Here is some more info that may be useful:

https://support.cloudflare.com/hc/en-us/articles/218378978-What-should-I-do-after-seeing-a-502-or-504-gateway-error-on-my-site-