How to self hosted Ghost in your cloud server

Written on 14 June 2015

After a time in love with Markdown, I choose Ghost to publish my blog post about what I have learned Tech Note. This is a note for: How I Install Ghost in Digital Ocean VPS cloud server. This is not fastest way but good. If you just want to use Ghost just go to and register an account.

First, I read some tutorial and do step by step but fail.
After that, I know what I should do to self host Ghost , that is:

  • Install Nodejs
  • Install Ghost.
  • Install Nginx or Apache
  • Install mysql or mariadb (optional)

My Cloud server is Ubuntu1 , It good. I suggested you should to use Ubuntu.

Install Nodejs

Download script to auto download install Nodejs

$ wget
$ sudo chmod +x
$ sudo ./

After that check version of node and npm

$ node -v

$ npm -v

Now install Ghost

Download latest Ghost version and extract to /var/www/ghost

unzip -uo -d /var/www/ghost  

Install Ghost module

cd /var/www/ghost  
npm install --production  

First run

npm start --production  

If all thing work, now go to http://:2368 , you will to setup your first user account for Ghost blog.
You can write your own blog post, at http://<your-ip-address>:2368/ghost . But we have some work to do for run solid ghost on cloud. Let's go !

Install Nginx

Install Nginx to server the world, and you blog can work when type

$ sudo apt-get install nginx

Create a virtual host

$ vim /etc/nginx/sites-available/ghost.conf

Copy these line

server {  
listen 80;  

location / {  
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   Host      $http_host;

Press i then Ctrl + Shift + V and Esc, final press ZZ
Test virtual host :
cat /etc/nginx/sites-available/ghost.conf If it same with what you copy , you have did right.

Now , keep going !

sudo ln -s /etc/nginx/sites-available/ghost.conf /etc/nginx/sites-enabled/ghost.conf  

Restart nginx to reload your config:

sudo service nginx reload  

Finaly, matching Nginx with ghost by config.js

vim /var/www/ghost/config.js  

Change your domain name

production: {  
        url: '',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            debug: false

Almost done, Now making Ghost run forever

cd /etc/init.d/


sudo useradd -r ghost -U  
sudo chown -R ghost:ghost /path/to/ghost  
sudo chmod 755 /etc/init.d/ghost  

Then vim /etc/init.d/ghost to edit

Then final command is:

sudo service ghost start  
$ sudo update-rc.d ghost defaults
$ sudo update-rc.d ghost enable

Now go to to start your first blog post.
If no thing work , some configure may not right, you must correct it. Or send a message to me @Epety

  1. You can register for DigitalOcean account here to run Ghost ↩

Read more on Tech Note Ghost