Setting up SSL

by

in

Continuing the story of this post, I had to setup HTTPS for my website. That means I had to go through the process of getting an SSL certificate, then installing it.

Getting the certificate

To get the certificate, I decided to use Certbot to get one from Let’s Encrypt. I may need to renew the certificate every 3 months, but that’s well worth getting one for free.

My first attempt, I realized that Certbot makes sure you own the domain by hosting a web server on your computer. Problem is, my domain doesn’t point to my computer. (I was running this on my personal computer, not the server NGINX is on.) Instead, I used ‘--preferred-challenges dns‘ to instead have Certbot give me a string to put in a TXT record on my domain’s DNS settings. I used nslookup to make sure the record had propagated, (which took like 30 minutes) and once that was done, I had my certificate.

Installing on Apache

Installing the certificate to the Apache server in the Docker container was a nightmare. Though it was only a nightmare because I had never done it before, and partially because I had to work around Docker.

I’ll spare you the details, but how I eventually got it working was just marking the virtual host as SSL and adding the SSL certificate locations to 000-default.config in available-sites. I also had to run ‘a2enmod ssl‘ to enable the SSL module. To make sure it persisted, I had to copy the apache2 folder from the container to a folder on my machine and mount it as a volume before running a2enmod.

Installing on NGINX

Installing on NGINX was way easier. One, because I understood what to do, and two, it’s not in a docker container. I just added the locations of the SSL certificate files and marked the server as using SSL. The NGINX SSL module was already enabled because my dad also uses the NGINX server for his website, but it would’ve been easier to enable due to not being in a Docker container.

Finishing in WordPress

Now my domain is working, and using HTTPS. The last thing I had to do was fix the site URL in WordPress so instead of localhost:port it would be justincoffman.com. WordPress was actually inaccessible at that time, so I spun up a PhpMyAdmin container and modified the site URL setting through the database directly.

Now the site truly begins.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *