Installing ghost on CENTOS 7 with nginx

Installing Ghost on a CENTOS 7 server that already runs nginx

Install the required nodejs and npm:
root@server# yum install nodejs npm

Install Ghost using npm:
root@server# npm install ghost

Install Process Manager:
root@server# npm install pm2 -g

Create a directory for the installation
root@server# mkdir -p /var/www/ghost ; cd /var/www/ghost

Download the latest Ghost release:
root@server# curl -L -o

Unzip package:
root@server# unzip -uo -d ghost

Move from ghost subdirectory to the base directory
root@server# mv ghost/* .

root@server# rmdir ghost root@server# rm

Install the application
root@server# npm install -production

Copy the sample config file:
root@server# cp config.example.js config.js

Edit url in file node.js to your

url: '',
url: '',

Start ghost:
root@server# NODE_ENV=production pm2 start index.js --name "Ghost"

Configure your nginx to forward traffic from port 80 to port 2368 usually in the file /etc/nginx/conf.d/

root@server# server { listen; server_name; access_log /var/log/nginx/yourdomain.log;

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

    proxy_redirect off;


Restart nginx:
root@server# systemctl restart nginx.service