So after finally migrating content off my ISP's static page hosting onto an EC2 instance (t2.micro, Debian/Jessie) running nginx, what to do with this new found VPS freedom? Self-host ghost of course!
It seems to be traditional for a first ghost post to describe the process of setting it up. This (as the Jessie EC2 images' admin user) worked for me (NB this is all after nginx was all up and running and serving static content from
/var/www just fine):
cd ~ sudo apt install nodejs npm # See /usr/share/doc/nodejs/README.Debian for why: sudo ln -s /usr/bin/nodejs /usr/bin/node sudo npm install ghost cd node_modules/ghost sudo npm install npm start
...and that got me a ghost running at localhost:2368. (I subsequently discovered it might have been a good idea to add a
--production to the ghost install to reduce the amount of cruft fetched.) Anyway, Ctrl-C-ed that, configured
node_modules/ghost/config.js (just the couple of url lines needed changing), configured nginx to proxy blog.timday.com to ghost (there's a ton of info on the web how to do this; obviously it needed DNS setting up for that subdomain too), and restarted with
npm start --production
And that gave me http://blog.timday.com. After setting up as a user in Ghost (all done through the web UI), the only thing remained was to make sure it'll run automatically. There's various options listed here; I went for "supervisor" with
[program:ghost] command = node /home/admin/node_modules/ghost/index.js directory = /home/admin/node_modules/ghost user = admin autostart = true autorestart = true stdout_logfile = /var/log/ghost.log stderr_logfile = /var/log/ghost_err.log environment = NODE_ENV="production"
And a reboot of the instance confirms everything comes back nicely afterwards. Super!