In this quick and simple post I will show you how to generate a free SSL certificate for Apache using letsencrypt and certbot, this will allow your users to view your website or blog over a secure and encrypted HTTPS connection instead of a standard insecure HTTP connection. For the purpose of this guide I will assume you are using Ubuntu server but if you need help getting it to work on a different OS then feel free to comment.
Lets start by installing all of the required packages. You will need to add the following repository:
sudo add-apt-repository ppa:certbot/certbot
Next you will need to update your packages list and install the actual packages:
sudo apt-get update && sudo apt-get install python-certbot-apache
After the required packages have been installed you will need to generate your certificate, this nifty tool will also walk you through the steps to enable your certificate. (Replace teachmelinux.com with your domain!)
sudo certbot --apache -d teachmelinux.com
When asked about redirecting traffic, it is up to you whether you want to force people to use HTTPS or still allow HTTP. I always pick to redirect as there is no reason to allow HTTP for my uses.
Once you have finished installing the certificates you can verify their existence by running the following command (again replace teachmelinux.com with your domain):
The final step and it’s important not to forget, setup automatic cert renewal. If you don’t setup automatic SSL cert renewal then your certificate will expire in 60 days and users will receive certificate warnings when visiting your site. You can add a cronjob that accomplishes this by running the following:
echo "0 1 * * * /usr/bin/certbot renew --quiet" >> /etc/crontab
I hope you enjoyed this quick guide on setting up a free SSL certificate on your Apache server, please don’t forget to like/share/comment! =)