Ghost is a very popular open source blogging content management system. It is fully customization from your own server and many themes are available in ghost marketplace. A lot of people switch their site from WordPress to Ghost for its great features.

Here following the steps to install and configure ghost on CentOS :

Requirements :

  • Minimum 1 GB Server where installed CentOS 7.
  • Node.js installed on that server using the EPEL repository method.
  • Nginx installed on that server.

Step 1 : Installing Node.js

That is essential to install node.js in your server to use ghost. If you are already installed that in your server then you may skip that setp #1. Run the following commands to install Node.js :

sudo yum install epel-release

Now you will get the acess of EPEL repository to install Node.js using the following commands :

sudo yum install nodejs

After installing Node.js, you may check the version from there by using the following command

node --version

Install npm to manage the Node packages. Just use the following command,

sudo yum install npm

Step 2 : Install and configure ghost

01. At first create the directory where you install ghost. For example if you want to install ghost inside var/www/yoursitename directory. Then create your desire directory location first and then enter on it. Use the following commands:

wget https://ghost.org/zip/ghost-latest.zip
unzip -uo ghost.zip -d  /var/www/yoursitename

02. Make sure you are on the new ghost directory.

cd /var/www/yoursitename

03. Now install production dependencies for ghost.

npm install --production

By default ghost will use 2368 port for your ghost installation, so make sure that port is open on the firewall to allow access. You may change that easily from /var/www/ghost/config.js

Step 3 : Start Your Ghost Blog

To start your ghost blog, use the following command,

npm start --production

Your blog address should be like that, http://SERVER_IP:2368

Step 4 : Install and Configure Ghost for Nginx

yum install nginx
systemctl start nginx

Now open the niginx folder from your server /etc/nginx/

Create a yoursitename.conf file there and add your server configuration for that ghost blog.  Here following an example of  that :

server { listen 80; server_name your_domain_or_ip_address; location / { proxy_set_header HOST $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:2368; } }

And then restart your nignx server.

 systemctl restart nginx

Note: Ghost officially does not support CentOS for the ghost installation, so you may face trouble to update your ghost in future. We strongly recommend you to use Ubuntu for your ghost server. If you are existing customer of themeix, feel free contact us to install ghost in your server.