From the cPanel SOFTWARE section, click the Setup Node.js App icon.
Click the CREATE APPLICATION button. Complete the fields. In our example, we will be installing the application in /home/youraccount/myghostblog, and be serving it from http://krystaldemo.co.uk/blog, using Node.js version 10.
Installation of the Ghost blog software must be done from the command line. SSH into your account, and enter this command (replacing your cPanel username and Application root as required).
source /home/krystald/nodevenv/myghostblog/10/bin/activate && cd /home/krystald/myghostblog
This will enter you into a virtual shell environment setup for the Node.js version your application uses. Entering the pwd command should show that you are now in the application's root directory.
You'll see something like:
Next, install the ghost-cli, a command line interface for managing ghost installations by typing the following:
/home/krystald/nodevenv/myghostblog/10/lib/bin/ghost -> /home/krystald/nodevenv/myghostblog/10/lib/lib/node_modules/ghost-cli/bin/ghost + [email protected] added 363 packages from 191 contributors in 27.297s
The ghost binary (which is actually the ghost-cli binary) is installed. We will need your version of the path highlighted in bold from this response in a while, so make a note of it.
Now, we must remove all files from the application root directory (/home/krystald/myghostblog) so it's empty again (otherwise ghost won't install in the next step). BE VERY CAREFUL to make sure you are in the correct directory - enter the pwd command again to make sure you are in the Application root directory before issuing the rm -rf * command
You should see your application root path:
Once the path is confirmed type the following to remove all the files:
rm -rf *
Now we are ready to install the ghost blog software itself. We don't want it to try and install nginx or MySQL, so we use the --no-setup option along with the ghost cli command we highlighted above.
$ /home/krystald/nodevenv/myghostblog/10/lib/bin/ghost install local --no-setup
You'll see a response something like this:
✔ Checking system Node.js version ✔ Checking current folder permissions ✔ Checking memory availability ✔ Checking for latest Ghost version ✔ Setting up install directory ✔ Downloading and installing Ghost v2.31.1 ✔ Finishing install process
This process can take a minute or two, so please be patient. Once installed, there are a few things we need to do in order to get Ghost running. Passenger, the software which allows your application to be served via LiteSpeed, requires the public directory exist in the Application root, so run the following commands:
chmod 755 public
Type the following to view your Application root file structure:
It should look something like this:
drwxr-xr-x 5 krystald krystald 103 Oct 3 08:57 . drwx--x--x 24 krystald krystald 4096 Oct 3 08:53 .. drwxrwxr-x 8 krystald krystald 108 Oct 3 08:51 content lrwxrwxrwx 1 krystald krystald 42 Oct 3 08:53 current -> /home/krystald/myghostblog/versions/2.31.1 -rw-rw-r-- 1 krystald krystald 60 Oct 3 08:53 .ghost-cli drwxr-xr-x 2 krystald krystald 10 Oct 3 08:57 public drwxrwxr-x 3 krystald krystald 27 Oct 3 08:51 versions
Because ghost-cli installs the app into [Application root]/current, we need to create the default app.js file expected by Passenger and tell it where to find the Ghost application bootstrap file. Start Nano from the command line with:
once in nano, type the following as the first and only line
The next step requires considerable editing, so you may want to edit the file locally using an editor of your choosing. Use your details for the paths as well as the MySQL database name, database user and password. Modify ./current/core/server/config/env/config.production.json so its contents are as follows (changing your domain as required):
Once you have modified the above file and saved it, go back into the cPanel Node.js management screen, and restart the application using the Actions controls on the right hand side.
If all is well, you should now be able to browse to your website at the URL you set the application up on, in our case, http://krystaldemo.co.uk
It may take a few moments for the application to start, during which time you may see the following message.This is normal. After a few moments you should be able to refresh the page and see your blog.
To setup our blog, browse to http://krystaldemo.co.uk/blog/ghost/#/setup (your URL will differ, depending on the URL you setup for the Application) - here you can setup your own admin login:Once you have setup your admin area, to get back to the admin login in future, simply append ghost to the end of your blog URL e.g. http://krystaldemo.co.uk/blog/ghost