Nginx 502 - Bad Gateway Error
When trying to open your website, you may see the following error message:
502 - Bad Gateway
What does this error mean?
The error message "502 - Bad Gateway" is generated by the free hosting server because your website code takes too long to generate a page.
There are various reasons why this could happen.
The first option is that your website code is big and heavy and takes a long time to load, so the server terminates the connection.
The second option is that the server is having trouble executing your code fast enough. This can happen especially on the first time someone loads the website in a while. The server may need some time to "warm up" your account. If that's the case, reloading the page usually makes it work.
What can I do to resolve this?
The first thing to try is to optimize your website. Try to disable unnecessary plugins, addons or themes. You can also try to set up caching, if your software supports it.
You can also try to disable any extra services between your visitors and your website, like Cloudflare. Sometimes, these services have problems communicating with your website, and disabling them will allow your website to open normally.