In all of my excitement to get started playing around with Ghost I failed to realize the server understanding needed to get it properly installed and setup. I am not saying that Ghost is terribly difficult to install and setup, but what I found out is that unless things go perfectly with the tutorial you use you could find yourself stuck.
That’s what happened to me, and this article is meant for those wanting to install Node.js and Ghost on a Media Temple DV server.
Chances are if you are reading this article you know what Ghost is, but in case you don’t here is a brief explanation.
Ghost is a CMS that was built out of the need for a simpler way to…well simply blog. WordPress is great, but can be a little much sometimes if you want to just write. Ghost solves that with a very simple backend that allows you to write using Markdown and easily publish your ideas to the web.
You can learn more about Ghost at www.ghost.org.
Specifically we are going to look at installing and setting up Ghost on a Media Temple DV level 4 server running Plesk (v11.0.9) and nginx. I first have to give a huge thanks to Fabian B @barajasfab for helping me get this working and writing the original how-to which you should check out as well. I have taken his instructions and made some adjustments based on mediatemple’s DV setup.
Ghost runs on Node.js and by default your server will not come with Node installed.
NOTE: You will be prompted after Node.js has been installed to install Ghost. DO NOT install Ghost at this point.
We need to step out of the command line for a sec and head into Plesk.
Now for the main event…installing and configuring Ghost CMS. You will need to be back in the command line for these steps.
cat << _EOF_ > /var/www/vhosts/<your-domain.com>/conf/vhost.conf ProxyPass / http://localhost:8000/ ProxyPassReverse / http://localhost:8000/ _EOF_
If you get a No such file or directory error then run the command below and then repeat step #1.
touch /var/www/vhost/<your-domain.com>/conf/vhost.conf
cd /var/www/vhosts/<your-domain.com>/httpdocs/ curl -L https://ghost.org/zip/ghost-latest.zip -o latest.zip && unzip latest.zip rm -f $_ cp config.example.js config.js
nano config.js
, or if you feel more comfortable you could FTP into your server and edit the file in your text editor.You need to edit url, host, and port in the Production section of config.js.
url = http://<your-domain.com> host = 127.0.0.1 port = 8000
npm install --production
There are a couple of things we want to do to make sure that Ghost runs forever, and we also want to give ourselves an easy way to start and stop Ghost.
npm -g install forever
cat << _EOF_ > ghostStart.sh #!/bin/bash NODE_ENV=production forever start index.js _EOF_
cat << _EOF_ > ghostStop.sh #!/bin/bash forever stop index.js _EOF_
chmod 750 ghostSt*
./ghostStart.sh
web /etc/init.d/httpd restart
If the alis `web` is not setup run the command below
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain <your-domain.com> /etc/init.d/httpd restart
Congrats, you did it! Your next step is to visit http://<your-domain.com>/ghost and enter in your details to set yourself up as an admin.
Again, a big thank you to Fabian B @barajasfab for doing most of the leg work on this.