To see how to deploy a WordPress site from scratch please check out this previous article where we went through the process step by step. In this article we set up automatic HTTPS, that means all the HTTP requests are redirected also to make sure all traffic is encrypted between the connecting clients and our server - that is extremely important if we have a webshop ,where we handle credit card- and other sensitive information.
We start were we left off. Our new WP site is up and running, publicly accessible and using unencrypted, plain HTTP as seen below.
Let’s Encrypt provides free SSL certificates that are valid for 3 month and their agent automatically renews them 30 days before expiry to ensure service continuity. We proceed to install the certbot agent on the server, then request the certificate for our domain. The agent will configure the involved virtual hosts for us, we just check them after creation to make sure they function as intended.
Going through the setup process as an example:
As the setup summary says we have the current certificates (technically symlinks to them) in /etc/letsencrypt/live/protectigate.com. Now have a look on the changes the agent has made to our virtual host. In /etc/apache2/sites-available we had only protectigate.conf before, now we have a protectigate-le-ssl.conf automatically generated by certbot.
-rw-r–r– 1 root root 1332 Jul 16 2019 000-default.conf
-rw-r–r– 1 root root 6338 Jul 16 2019 default-ssl.conf
-rw-r–r– 1 root root 321 Apr 2 12:26 protectigate.conf
-rw-r–r– 1 root root 362 Apr 2 12:26 protectigate-le-ssl.conf
Opening the protectigate.conf we see that forwarding HTTP to HTTPS is set now.
The new protectigate-le-ssl.conf file contain the inclusions and certificate details which is needed for the secure data transfer
Furthermore, the agent created a cron job, that checks every 12 hours if the certificates are going to expire and if so, renews them automatically so we won’t need to worry about it. If the cert is not renewed on time (which is 30 days before the end of validity), 20 days before expiry an email will be sent out to us from the central Let’s Encrypt center to notify us and give us time to rectify issues.
The site defaults to HTTPS as we see now 🙂
Comments