Encountering a “502 Bad Gateway” error while using Ghost CMS can be frustrating, especially when you’re in the middle of updating or maintaining your blog. Fortunately, this issue can often be resolved with a simple tweak to your configuration files. In this post, I’ll walk you through the steps I took to fix this error.

The Issue

After some more Googling, I discovered that the root cause of my “502 Bad Gateway” error was a port change in Ghost. The default port for Ghost is 2368, but for some reason, it had increased to 2369.

The Solution

To resolve this, I needed to update the port configuration in my Nginx files. Here’s how you can do it too:

1. Open your Nginx configuration files: Navigate to the /etc/nginx/sites-enabled directory. This is where Nginx stores the configuration files for all enabled sites.

cd /etc/nginx/sites-enabled

2. Open your website config file

3. Update the port number: Look for the line that specifies the proxy_pass directive. This line tells Nginx where to forward requests. If it shows port 2368, change it to 2369.

Thats all!

Share this post