This is a copy of what I built for getting a server set up to host a Ghost blog, including the download, configuration, and running of each Ghost instance on NGINX.
Note: This hasn't been well vetted for public consumption yet, but I wanted to open it up in case it could be of use to anyone else. Please submit any issues or pull requests if you see room for improvement!
- Installs Node.js and npm
- Downloads and extracts the latest stable version of Ghost
- Creates a separate Ghost installation for each site specified in
./group_vars/ghost.yaml
- Configures an Upstart script for each site to recover if it goes down
- Ansible on your host machine
- A server with SSH access for the root user (if you want to change the SSH
user, you can do so in
./group_vars/ghost.yaml
)
-
Set up a server with SSH access for the root user.
-
Add your public key so you can SSH without a password. I like
ssh-copy-id
(OS X, Linux). -
Edit the following files:
./group_vars/ghost.yaml
Add each of your sites - along with a unique port number - to thesites:
defition, following the template provided.ghost-config.js.j2
This is the Ghost config that will be used for each site. The domain and port will be inserted automatically fromgroup_vars/ghost.yaml
, but you should set up mail and anything else you need.hosts
Replace the example IP with the address of your server.vhost.conf
This is the virtualhost config template that will be used for each site. Note the URL redirect at the bottom.
-
Next, run
./bin/server
to set up the necessary pieces on the server. You should only have to do this once, but it is idempotent and can be run as many times as you need. -
Run
./bin/sites
once to set up each of the sites specified in./group_vars/ghost.yaml
. As withserver
, you can run this multiple times without ill effect. While it won't touch your content directory, making a backup is always a good idea. :)
Just some things I referenced while setting this up.
Finally, much ❤️ to the Ghost team for creating this awesome platform, and to Ansible for being badass as always. 👍