Setting up a wordpress blog with SSL and custom domain for $6 per month
When I started this blog I wanted to host it on Azure but it would have cost roughly $100/month with my requirements of SSL and custom domain. There are some nice benefits of Azure but I realised I needed a blog and WordPress is the king of blogs.
I started my blog on wordpress.com just so I could start writing before the enthusiasm fizzled out. This is really awesome for free blogs but the costs quickly add up if you want to add a custom domain, SSL and google analytics. All of this requires the business package and costs $25/month (at time of writing). You are also prevented from installing many themes and plugins here. I did some searching for a cheaper host and settled on DigitalOcean .
Create the WordPress droplet
Digital Ocean is a container based host. They call the containers droplets. To create your cheap WordPress site go to DigitalOcean and sign up. You get a month free with that link. After signing up select “Create Droplet”. In the page that opens click the “One Click Apps” tab.
Scroll down and select the WordPress 4.7 on 16.04
Select the smallest size droplet. This should be fine as you start.
I recommend getting a backup of your droplet. This is a weekly backup for $1/month. Pretty good deal I’d say.
That’s it! Just wait for the droplet to spin up. You’ll get an IP address and username password in an email. The IP is also available on your Droplets page.
Setup the WordPress blog
On windows you’ll have to download putty to log in to your new droplet. Visit http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html and get the full msi installer.
Use the IP, userame and password to log in to the new droplet using putty.
<pre class="code-pre "><code>ssh email@example.com</code></pre>
Next visit your wordpress site in your browser – http://192.168.1.1 – but replace the IP there with the one for your droplet and follow all the prompts to install WordPress. Don’t use “admin” as the main account.
Setup some security
Next you should set up some security on the droplet. run the following to display your passwords. The mysql secure installation script will ask for the root password later.
and follow the prompts. You probably want to say yes to everything.
Now make sure mysql is started
service mysql start
Setup your domain
If you have a custom domain then digital ocean can act as a nameserver for you for free. It’s best to configure digital ocean first before changing nameservers on the domain. If this is a new domain then add the following records under networking.
Create TXT records for
www.mycustomdomain.com VALUE www.mycustomdomain.com *.mycustomdomain.com VALUE www.mycustomdomain.com mycustomdomain.com VALUE www.mycustomdomain.com
and A records for
www.mycustomdomain.com VALUE 192.168.116.115 *.mycustomdomain.com VALUE 192.168.116.115 mycustomdomain.com VALUE 192.168.116.115
Now change the nameservers for your domain to point to digital oceans name servers.
Set up SSL
You can get free SSL with Let’s Encrypt. First get cert-bot.
sudo wget https://dl.eff.org/certbot-auto
then make it executable.
sudo chmod a+x /usr/local/sbin/certbot-auto
Then run for the domains you would like to add certs for.
certbot-auto --apache -d mycustomdomain.com -d www.mycustodomain.com
Using a cron job to renew your certs automatically
Open your crontab file
sudo crontab -e
and add the following line to the end of the file but replace XX with a number between 0 and 59
XX 2 * * 1 /usr/local/sbin/certbot-auto renew >> /var/log/le-renew.log
That’s it! You’re done. A wordpress blog with SSL and custom domain for $6.