services are being migrated from an existing standalone LXD/LXC server into the new cluster. Various media libraries, web hosts, blog sites, and photo sharing, also a NextCloud instance I use instead of Google Drive. I don't know why I do this to myself.
Previously I was using Ghost (Pro) to host my blog, however, the tiny amount of traffic did not justify the annual cost. I decided to move the site over to my own host and use Cloudflare as a CDN to provide caching. I also setup SNI Proxy to allow for multiple sites on the same external IP, athough this is not an officially supported configuration.
- Ubuntu 16.04
- SQL database (local or remote)
- Domain name, with nameservers pointing to ->
- Cloudflare DNS resolvers, which point to ->
- Static IP or Dynamic IP if a DNS updater is used
Add Node repo
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
Install nginx, node, build tools
sudo apt install -y nodejs nginx build-essential
sudo npm i -g [email protected]
Create SQL database
I chose to do this on my remote SQL server, but this could be a locally installed SQL/MariaDB instance.
If you need a local database:
sudo apt install mariadb-server
Then follow the same steps, substituting localhost for the hostname.
For remote SQL server
Login as the root user (will prompt for password):
mysql -u root -p
CREATE USER 'username'@'ghosthostname'; CREATE DATABASE ghostdatabase; GRANT ALL PRIVILEGES ON ghostdatabase.* TO 'username'@'ghosthostname' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
Exit the SQL session with
Test SQL connection
Requires a sql client installed
sudo apt install mariadb-client
mysql -u username -h databaseservername -p
You should be prompted to enter the password, and not get a failed connection message.
Back to the ghost install
Create the ghost install directory:
sudo mkdir -p /var/www/ghost
Change the directory owner:
sudo chown -R USERNAME /var/www/ghost
NOTE: it is best to own/run as a user created specifically for ghost
Switch to the directory:
Fill in the details for your site URL and SQL database when prompted. The wizard will mostly take care of the rest, but check the below for gotchas.
Things to note
If you intend on hosting your site over HTTPS, enter the site name with https://YOURDOMAIN otherwise ghost will have issues later (broken redirects).
Ghost will automatically use Let's Encrypt to setup and configure nginx for serving your site securely over HTTPS. However as there are several sites behind my single external IP, answer
No to the SSL setup question. I set this up later and it's covered in the Cloudflare/Let's Encrypt article.
If later you need to adjust what you entered during ghost setup, you can modify the configuration.
ghost setup STEP
STEP is the stage that broke
If something totally breaks
The nuclear option
If ghost uninstall doesn't fix it, something went really wrong.
sudo rm -R /var/www/ghost
Allow nginx through the firewall
If UFW is enabled, we need to let nginx through:
`sudo ufw allow 'Nginx Full'
Test your site by visiting https://HOSTNAME
To update the Ghost command line interface
sudo npm install -g [email protected]
To update the installed Ghost blog
It's never done...