How To Secure Your Website with Let's Encrypt on Ubuntu

Securing your website is a critical step in ensuring the safety and privacy of your users' information. Let's Encrypt, a popular Certificate Authority, offers free SSL/TLS certificates, making it a go-to solution for many website administrators. This article will guide you through the process of securing your website with Let's Encrypt on an Ubuntu server.


  • A running Ubuntu server
  • A registered domain name
  • Administrative access to your server
  • Apache or Nginx installed (this guide will focus on Apache)

Step-by-Step Guide

1- Update Your Server:

Begin by updating your server's package manager.

sudo apt-get update
sudo apt-get upgrade

2- Install the Certbot Tool:

Certbot is an easy-to-use automatic client that fetches and deploys SSL/TLS certificates for your web server. Install it using:

sudo apt-get install certbot python3-certbot-apache

3- Choose Your Domain:
Certbot needs to know which domain you're securing. Ensure your domain points to your server's IP address.


4- Run Certbot:
Execute the Certbot tool with Apache:

sudo certbot --apache

Follow the on-screen instructions. Certbot will ask for your email address and agreement to the terms of service.


5- Verify SSL Certificate:
Once Certbot has run, it should automatically set up an SSL certificate and configure your Apache server to use HTTPS. Verify this by accessing your website with https://.


6- Set Up Automatic Renewal:
Let’s Encrypt certificates are valid for 90 days. Set up a cron job to automatically renew them.

echo "0 12 * * * /usr/bin/certbot renew --quiet" | sudo tee -a /etc/crontab > /dev/null

7- Test Automatic Renewal:
Test the renewal script with:

sudo certbot renew --dry-run

8- Adjust Firewall Settings (If Applicable):
If you're using a firewall, ensure that HTTPS traffic is allowed. For UFW (Uncomplicated Firewall):

sudo ufw allow 'Apache Full'
sudo ufw delete allow 'Apache'

9- Confirm Configuration:
Finally, check your website's security status using online tools like SSL Labs' SSL Test.


Securing your website on an Ubuntu server using Let's Encrypt is a straightforward process that greatly enhances your website’s security. Regularly renewing your certificates ensures ongoing protection. By following these steps, you can achieve a higher level of security and trust with your users, which is crucial in today's digital landscape.

For more insights into the importance of website certificates, refer back to our previous article: Why Are Website Certificates Important? An In-Depth Look.