Ghost is a free and open-source publishing platform built on Node.js technology. Ghost is the fast, modern WordPress alternative, focused completely on professional publishing. If you just want to focus on publishing without all the extras, Ghost is the platform for you. Check out more information at Ghost.org.
In this post, we will discuss how to install the open-source Ghost CMS using RunCloud.
1. Get Your Cloud Server And Connect To RunCloud
A cloud server is the best choice when you want to run Ghost CMS. Five dollar ($5) cloud server from DigitalOcean / Linode / Vultr / UpCloud / other provider is enough to start using Ghost CMS.
Quick guide on how to set up and connect your server to RunCloud
2. Create Web Application In RunCloud
After setup and connect your server to RunCloud, you can create a web application to install Ghost CMS.
Using RunCloud, you can create multiple websites (web applications) in one server. It means you can install Ghost CMS on the same server where you host your other websites using RunCloud. You can also have multiple Ghost CMS-powered websites on the same server.
Go to the “Web Application” menu under your server in RunCloud, and click the “Create Web App” button.
Please choose “Custom Web Application” for Ghost CMS.
For “Web Application Stack“, you can choose “Native Nginx + Custom Config” for Ghost CMS. This stack will not serve your PHP file.
For “Web Application Name“, you can use “myblogapp” or a name that lets you know to identify this web application easily.
For “Web Application Owner“, you can create a new “mybloguser” system user.
It is best practice to use different system users for different web applications on the same server, for an extra security benefit.
For “Domain name“, you can use your own domain or subdomain.
It is possible to install Ghost using RunCloud’s test domain for testing only. If you want to play with this tutorial without having to setup your own domain or subdomain, then use the RunCloud test domain.
Quick guide on how to add your domain/subdomain.
If you decide to use your own domain or subdomain, you will need to do an extra step to configure DNS record and wait for DNS propagation.
3. Secure Ghost CMS With HTTPS
Once your domain or subdomain is fully propagated, you can secure your website with HTTPS.
RunCloud provides free Let’s Encrypt SSL/TLS for all websites in your RunCloud server.
Quick guide on how to secure your website with HTTPS (Let’s Encrypt SSL/TLS)
IMPORTANT! When adding Let’s Encrypt SSL/TLS to your Ghost CMS web application, you can enable the “HSTS” option.
4. Create Database
Go to the “Database” menu under your server in RunCloud to create your MySQL database for Ghost CMS.
Click the “Create Database” button and create new “myblogdb” database.
Click the “Create Database User” button and create new “myblogdbuser” database user.
Then click the “Grant User” button in your “myblogdb” database to connect it to “myblogdbuser” user.
5. Unlock Admin Privileges
In step 2, we create a web application using “mybloguser” system user.
We need to add this user to the superuser group to unlock admin privileges for this user.
Please login to your server as the root user using Terminal (Mac OSX / Linux) or Powershell / Putty (Windows). Please change “youripaddress” with the IP Address of your server.
ssh root@<youripaddress>
After you have logged in to your server, please run this command.
usermod -aG sudo mybloguser
Then run this command to log out from your server.
exit
Admin privileges is needed to allow this system user to install Ghost-CLI. Please review official documentation to install Ghost in Ubuntu. You can remove admin privileges of this system user after installing Ghost-CLI, if needed.
6. Install Ghost-CLI
Ghost-CLI is a command-line tool to help you get Ghost CMS installed and configured for use, quickly and easily.
Please login to your server as “mybloguser” system user using Terminal (Mac OSX / Linux) or Powershell / Putty (Windows). Please change “youripaddress” with the IP Address of your server.
ssh mybloguser@<youripaddress>
You can change the password of “mybloguser” system user that you have created from the System User menu.
NOTE: Please do not login as “root” user, to avoid any file/folder permission issue.
Change the working directory to your “myblogapp” web application root path.
cd webapps/myblogapp
Remove default index.html file in your web app
rm index.html
Run this command to install Ghost-CLI
sudo npm install ghost-cli@latest -g
Once installed, you can try to run this command to show a list of available commands.
ghost help
7. Install Ghost
After installing Ghost-CLI, you can run this command to start Ghost CMS installation.
ghost install
Follow the process, enter your blog URL, and database information that you have created on step 4.
For “Do you wish to set up Nginx”, please enter “No”.
For “Do you wish to set up Systemd”, please enter “Yes”.
For “Do you want to start Ghost”, please enter “Yes”.
8. Set up Nginx Config
In step 7, we skip setting up the Nginx process.
If you try to visit your Ghost website, you will see a 404 Not Found screen.
It is normal because we need to setup Nginx manually.
Before we set up Nginx config, we need to know which port that Ghost will use for this website.
Please run this command.
ghost ls
From this example, you can see that our Ghost website uses port 2369. We will use this port number later.
Now, go back to the RunCloud dashboard, open your web application, and go to the Nginx Config menu.
Click the “Create Config” button and follow the steps below.
For “Type” option, make sure to select “location.root” value.
For the “Config Name” option, you can use “ghost” value.
For “Config Content” textarea, copy & paste text below:
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;
proxy_pass http://127.0.0.1:XXXX;
Please change XXXX with the port number above.
You can click “Run and Debug” to see if there are any issues with this custom config.
Click the “Add Config” button to finish it.
9. Set up Ghost CMS
After setup Nginx config, you can try to visit your website again.
https://youdomain/ghost
If your Nginx config works, you should see this screen.
Click the “Create your account” button and create your first admin account.
In the next process, you can invite staff users to your Ghost website. You can click “I’ll do this later” to skip this process.
And now you will be redirected to your Ghost dashboard.
Done! You have successfully install Ghost CMS in the RunCloud server.
10. Tips – Ghost Doctor
Before you start using your Ghost website, it is recommended to run “ghost doctor” CLI to check any issue in your Ghost installation.
“ghost doctor” is a diagnostic tool to find potential issues for your Ghost install, and provides information about what needs to be resolved if any issues arise.
Please run this command to diagnose your Ghost website.
ghost doctor
If everything is green, it means your Ghost installation is great, and you can start using it.
11. Tips – Fix Permission Issues
If you get permission issues when running “ghost doctor”, you can add the current web app system user to “ghost” group.
Please login to your server as the root user using Terminal (Mac OSX / Linux) or Powershell / Putty (Windows). Please change “youripaddress” with the IP Address of your server.
ssh root@<youripaddress>
After you have logged in to your server, please run this command.
usermod -g ghost mybloguser
Then run this command to log out from your server.
exit
12. Summary
If you want to use Ghost CMS, powered by Node.JS, for your modern publishing platform, we show you how to install Ghost CMS using RunCloud.
More articles that useful for you.
Are you using Ghost CMS? Do not hesitate to share your experience with us.
Categories: Content Management System, Server Management, Tech Tips, Tutorials