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
- deploy Wordpress from Digital Ocean (from Marketplace > Wordpress on 18.04) (refer to previous blogpost for more details)
- ssh into your Droplet with
ssh root@use_your_droplet_ip - this should trigger your Wordpress instance to setup
- it will also ask if you want to perform SSL encryption on your Wordpress instance
Prepare your domain name
- 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.
- go to your domain name and add a DNS record (for dnsimple its under DNS > DNS records > manage)
- 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')
- now test it by doing to your domain (e.g. http://tliqun-dev.com)
- if it links to your wordpress instance, you're all good for this section!
get an SSL certificate for your wordpress
- now back at the ssh-ed terminal, your instructions should be asking you to enter the domain name.
- 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)
- now go to your wordpress admin through your domain (e.g. https://tliqun-dev.com)
- you might notice some missing styles. Login into your admin
- download a plugin called "Really Simple SSL" and activate it
- click "activate"
- you will be kicked out of the admin panel. sign in again.
- go to Wordpress's Settings > General tab
- change your WordPress Address (URL) and Site Address (URL) to reflect the new domain name (e.g. https://tliqun-dev.com)
- 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