Setting up Ghost blog
To install the needed dependancies for the ghost blog run these commands
yum install npm nodejs
npm install forever -g
Then we will add a new user for ghost to run under
adduser ghost
then we must deny SSH access for this user do this by editing /etc/ssh/sshd_config
and adding the line DenyUsers ghost
restart the sshd service for changes to take affect. Now we can setup ghost blog
change to the ghost user by typing su ghost && cd
this will switch user to ghost and then change directory to there home folder. Now download ghost with
wget https://ghost.org/zip/ghost-latest.zip
unzip ghost-latest.zip -d example.com-2360
change example.com-2360 to your domain and port number you intend to use (incase you plan to host multiple ghost instances)
Then use
npm install --production
to install all the node modules needed for ghost
next thing to do is edit the config.js file
cp config.example.js config.js
in the production: {}
section edit this to suite your requirements you can also add your mailgun details in this section too. This will enable you to invite editors to the ghost blog and also reset passwords etc
mail: {
transport: 'SMTP',
options: {
service: 'Mailgun',
auth: {
user: '', // mailgun username
pass: '' // mailgun password
}
}
},
when you have editied all this to suite your requirements start the blog by using
NODE_ENV=production forever --uid=example.com start index.js
This will start up the blog with the options set in the production: {}
section if you wanted to start the blog with the development options replace NODE_ENV=production
with NODE_ENV=development
also replace the --uid=example.com
with anything you would like to call the service. When you make changes to a ghost blog like the theme or something you will need to restart it to see those changes do this by restarting the name given with the uid option for example
forever restart example.com
will restart the ghost blog.
Now we will setup a reverse proxy on NginX so you can view it at the correct domain with out using the port number
open up a new .conf file inside /etc/nginx/sites-available
folder and paste/edit this
server {
listen 0.0.0.0:80;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.access.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;
}
Restart NginX with service nginx restart
and then proceede to setup your ghost blog by going to http://example.com/ghost this will allow you to set up the owner details