Introduction
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, kana.ph 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
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 https://kana.ph, a familiar error screen will greet its visitors:
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.
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!
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.
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 kana.ph is now reachable!
Conclusion
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 kana.ph, Ghost is runs in port :2369
while Nginx tries to serve the application running in :2368
.