In this article i will show you how to install the Ghost blogging platform in Ubuntu using Node and Nginx web server.

Ghost is beautifully designed blogging platform, completely customisable and completely Open Source, as a matter of fact the blog you are on right now is using Ghost.

Ghost will let you write and publish your content, giving you the tools to make it easy and even fun to do optimized for speed and with multiple themes to choose.

Step 1

Logging in to your server

ssh [email protected]

Make sure your OS is up to date.

sudo apt-get update
sudo apt-get upgrade

Once that is done we will install NPM and Node JS from the chris-lea Node repository.

NPM is the package manager for JavaScript we will use it to get all the dependencies for your Ghost installation.

sudo apt-get install python-software-properties 
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install supervisor

#### Step 2 Installing Ghost

npm update
npm install ghost

Now we setup supervisor to autostart our Ghost blog on boot

sudo nano /etc/supervisor/conf.d/ghost.conf
[program:ghost]
command = node /home/user/node_modules/ghost/index.js
directory = /home/user/node_modules/ghost
user = user
autostart = true
autorestart = true
stdout_logfile = /var/log/supervisor/ghost.log
stderr_logfile = /var/log/supervisor/ghost_err.log
environment = NODE_ENV="production"
sudo service supervisor start
sudo supervisorctl start ghost

Step 3

Install and Configure nginx

sudo apt-get install nginx
sudo rm /etc/nginx/sites-enabled/default
sudo nano /etc/nginx/sites-enabled/ghost
server {
        listen 0.0.0.0:80;
        server_name **Your Domain Here**;
        access_log /var/log/nginx/ghost.log;

        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header HOST $http_host;
            proxy_set_header X-NginX-Proxy true;

            proxy_pass http://127.0.0.1:2368;
            proxy_redirect off;
        }
}
sudo service nginx restart

Step 4

Configure Ghost

go to your ghost url

http://example.org

And Create your account