5xx errors are due to Cloudflare not being able to successfully connect to the origin server. A 500 is a generic Internal Server Error at the source. I know it looks like both sides are pointing fingers, but here are some troubleshooting suggestions:
A 523 error means your DNS settings are probably incorrect. Or, if it was working before with HTTP, but not with HTTPS, then it means your server isn’t configured to use HTTPS/SSL for your website. Get your host to install SSL and that should fix it. Review the Quick Fix Ideas in this Community Tip for troubleshooting ideas.
A 524 error indicates that Cloudflare made a successful TCP connection to the origin web server, but the origin did not reply with an HTTP response before the connection timed out. Review the suggestions in this Community Tip for troubleshooting ideas.