Periodic 502 Bad Gateway

I am seeing a periodic 502 bad gateway error when loading my site:

Sometimes it loads and sometimes I receive a 502 Bad gateway error. So my site is working on and off.

I’m running the latest version of Ghost (3.42.0) on Digital Ocean.

The only thing I changed recently was to add a https www URL so that resolves and redirects to I followed the directions under “SSL for additional domains” here:

I also added a new A record for “www” to point to my DO instance. I since removed that in case that was causing issues.

Is there any reason why sometimes the site loads successfully and sometimes it shows a 502 bad gateway error?

Do you have anything in the Ghost error or access logs?

When you get the 502 error, do you see the request in the Ghost access logs? (I think technically there are two places where you should be able to see access attempts: one from Ghost itself in /var/www/ghost/content/logs/ and another in NGINX).