Https for Wordpress on Digital Ocean

*these steps should also work with any deployment, as long as you are able to deploy a Wordpress instance that gives you an IP address

<span class="text-highlight">make sure you have backed up your wordpress data before you do this. I am not liable for your data loss.</span>

Initial Setup

  1. deploy Wordpress from Digital Ocean (from Marketplace > Wordpress on 18.04) (refer to previous blogpost for more details)
  2. ssh into your Droplet with ssh root@use_your_droplet_ip
  3. this should trigger your Wordpress instance to setup
  4. it will also ask if you want to perform SSL encryption on your Wordpress instance

Prepare your domain name

  1. I had a domain name in my back pocket, but if you don't, and would like to follow along by buying a domain name, try dnsimple, it has given me the least amount of headaches so far for DNS.
  2. go to your domain name and add a DNS record (for dnsimple its under DNS > DNS records > manage)
  3. add an A record that tells your domain name to jump to the given IP address (your digital ocean deployment IP address) (in my case it was 'tliqun-dev.com' and '68.183.234.158')
  4. now test it by doing to your domain (e.g. http://tliqun-dev.com)
  5. if it links to your wordpress instance, you're all good for this section!

get an SSL certificate for your wordpress

  1. now back at the ssh-ed terminal, your instructions should be asking you to enter the domain name.
  2. enter your recently connected domain name, and follow along with the instructions. (note: resolving to www.your-domain-name doesn't work unless you actually setup for it)
  3. now go to your wordpress admin through your domain (e.g. https://tliqun-dev.com)
  4. you might notice some missing styles. Login into your admin
  5. download a plugin called "Really Simple SSL" and activate it
  6. click "activate"
  7. you will be kicked out of the admin panel. sign in again.
  8. go to Wordpress's Settings > General tab
  9. change your WordPress Address (URL) and Site Address (URL) to reflect the new domain name (e.g. https://tliqun-dev.com)
  10. now go enjoy your SSL encrypted https wordpress site!

<span class="text-highlight">Note that the certificate will expire and will not auto renew.</span>

auto-renew your SSL certificate!

[this guy wrote it really well, so i'm just going to link to his post instead] https://www.onepagezen.com/letsencrypt-auto-renew-certbot-apache/

ref