Fix Unreachable Self-Hosted Ghost after Update

Fix Unreachable Self-Hosted Ghost after Update


For those who did not know, Ghost has released a minor update today: Ghost 3.7.0.
This update has fixed a few members management related bugs. To be honest, I'm not affected by those fixes since Kana PH has no membership features and all the contents are available publicly.

With that, does not need to update and didn't need the new fixes the release has introduced. The update is done to have a feel on what the update process feels like since Ghost typically releases a minor version every week, or a major version every 12-18 months. This is also a great learning experience, especially to someone new in system administration.

How it Started – Update Ghost

It is nice to find that Ghost is easy to update.

First, login as ghost user and go the the Ghost installation:

sudo -i -u ghost-mgr

cd /var/www/ghost

Then, verify if there is an update available:

ghost check-update

When an update is available, just run the update command. Ghost will perform the upgrade for you:

ghost update
Ghost logs after running ghost update command.

Then, that's it! The ghost update command will restart the ghost service and in effect, the initialization of the configurations will start again.

Discovery – The site is unreachable!

When accessing, a familiar error screen will greet its visitors:

Screenshot grabbed online, but this is what appears in
Screenshot grabbed online, this is similar to what appears when opening the site behind Cloudflare.

Investigation – Ghost changed its running port and Nginx can't see it

When verifiying the status of Ghost and Nginx, both reports that their respective service is running correctly, without errors. This made the investigation difficult since there are no errors to start the investigation from.

ghost status
Command to print the status of the Ghost instance.
Result of ghost status command.
sudo service nginx status
Command to print the status of Nginx.
Result of service nginx status command.

After running these commands and seeing both services are active and run without errors, accessing the site still responds 502 Bad Gateway.

Next thing to look at is the proxy config at /var/www/ghost/system/files/ directory.

And behold! The culprit!

server {
    # Hidden: Listeners, server name, and TLS goes here...

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;

    # Hidden: Meta config goes here...
The value for proxy_pass is still pointing to :2368 where it should be pointing to :2369!

The Fix – Update proxy settings to correct port number

Yes, that's right. Just change the value for proxy_pass to the port Ghost is using to make it work again. Make sure to update the correct file, such as the <domain>.conf for the HTTP connection and <domain>-ssl.conf for the HTTP connection.

vi /var/www/ghost/system/files/
Just use your favorite text editor.

After saving the updated config file, just restart Ghost and Nginx for it to take effect:

ghost restart

sudo service nginx restart 

After a few seconds, Nginx is working again and is now reachable!


When the services are working fine independently, and the entire system is still not working, check the part where the services integrate with each other.

In the case of, Ghost is runs in port :2369 while Nginx tries to serve the application running in :2368.

Show Comments