This guide secures an Apache virtual host on Ubuntu 24.04 LTS with a free Let’s Encrypt SSL certificate using Certbot.

Tested and valid on:

  • Ubuntu 24.04 LTS

Prerequisites

  • Ubuntu 24.04 LTS server
  • Apache installed with a virtual host configured
  • Domain DNS A record pointing to your server
  • Port 80 and 443 open in UFW

Step 1 – Install Certbot and the Apache Plugin

Install Certbot:

sudo apt update
sudo apt install certbot python3-certbot-apache -y

Step 2 – Enable mod_ssl and mod_rewrite

Ensure the required modules are active:

sudo a2enmod ssl
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 3 – Obtain a Certificate

Run Certbot for your domain:

sudo certbot --apache -d example.com -d www.example.com

Follow prompts to enter email, agree to ToS, and enable HTTPS redirect.

Step 4 – Verify HTTPS

Visit https://example.com — confirm the padlock and certificate are valid.

Step 5 – Test Auto-Renewal

Test the automated renewal process:

sudo certbot renew --dry-run

Step 6 – Check Renewal Timer

Confirm the timer is running:

sudo systemctl status certbot.timer

Step 7 – View SSL Certificate Info

Inspect the installed certificate:

sudo certbot certificates

Conclusion

Apache on Ubuntu 24.04 LTS is now serving your site over HTTPS. Certbot automatically renews certificates before expiry — no manual work required.