Overview
Ghost is a gorgeous blogging platform supported on Developer+ accounts on v6+ platforms. Ghost requires terminal access to deploy and hooks into Passenger affording simple process management.
Quickstart
This guide is designed to get Ghost up and running with the fewest steps. Ghost will be SQLite as a database backend, but you might want to configure it to take advantage of MySQL’s improved throughput.
- Login to the terminal
- Create a subdomain to serve Ghost. Since it’s launched with Passenger, you will need to make a Passenger-compatible filesystem layout
-
cd /var/www mkdir -p ghost/{tmp,public} cd ghost
-
- Download Ghost from ghost.org. At the time of writing, 0.6.4 is the latest version:
-
wget https://ghost.org/zip/ghost-0.6.4.zip unzip ghost-0.6.4.zip rm -f ghost-0.6.4.zip
-
- Ghost has been downloaded and extracted to
/var/www/ghost
. Ghost is a Node.js application that relies on third-party dependencies to run. These can be installed used the Node.js package manager (npm)- Install missing dependencies:
npm install --production
- Install missing dependencies:
- Connect
public/
to a subdomain within the control panel under Web > Subdomains
- Create a .htaccess control file in
public/
and set PassengerNodejs to inform the web server that this is a Node.js application to be launched with Passenger. `which node`
is shorthand to resolve the location of your Node interpreter as selected by nvm:-
echo "PassengerNodejs `which node`" >> public/.htaccess
-
- Create a MySQL database. Ghost connects over TCP socket, so ensure that remote permissions on 127.0.0.1 are granted to the user. By default, when a user is created, permissions are only granted to “localhost” and not 127.0.0.1.
- Edit
core/server/config/env/config.production.json
with your database credentials. Change user, password, and database fields.-
nano core/server/config/env/config.production.json
-
- Populate the database
-
env NODE_ENV=production knex-migrator init
-
- Finally, Passenger expects the entry-point to be named “
app.js
“. Ghost usesindex.js
as its startup file. Create a symbolic link fromindex.js
toapp.js
to satisfy Passenger:-
ln -s index.js app.js
-
- Once done, access /signup on the subdomain to setup your admin account
- For example, in this walkthrough, the URL on ghost.example.com would be http://ghost.example.com/ghost
- Enjoy!
Odds and Ends
Restarting
Node.js piggybacks Passenger, and in doing so, can be easily restarted using the tmp/
control directory. Follow the general guide to restarting a Passenger-backed application.