SSL on Ubuntu 24.04 Made Easy: Step-by-Step Setup for Apache

Learn how to set up SSL on Ubuntu 24.04 in minutes with this easy, step-by-step guide for Apache. Secure your server with confidence today.

Calista explores the world of SSL on Ubuntu 24.04 in a cozy, rustic library—your guide to securing Apache with ease.

If SSL on Ubuntu 24.04 feels complex, it’s time to learn how easy it can be with Apache.

Securing your website with SSL/TLS is crucial for protecting user data and improving trust among your visitors. When a website uses SSL/TLS, it encrypts the data exchanged between the server and the user’s browser, making it significantly more difficult for malicious actors to intercept sensitive information such as login credentials, payment details, or personal information. Furthermore, a secure connection is increasingly important for SEO, as search engines prioritize HTTPS-enabled websites over those that are not secure.

This enhanced security not only protects your users but also fosters a sense of confidence, encouraging them to interact with your site without fear of data breaches.

In this guide, we’ll walk you through the process of setting up Let’s Encrypt SSL on Ubuntu 24.04 with Apache. Let’s Encrypt provides a free, automated, and open Certificate Authority, allowing you to obtain an SSL/TLS certificate with minimal effort.

The process is straightforward and efficient, thanks to Certbot, which simplifies certificate installation and renewal. By following this guide, you will learn how to secure your website, ensuring that your users’ data is protected while also enhancing your website’s credibility and search engine visibility.

Also: Ubuntu CodeIgniter Setup: A Step-by-Step Installation Guide

What is SSL, Certbot, and Let’s Encrypt?

Securing your website with SSL on Ubuntu 24.04 is essential for encrypting data and protecting user information. SSL (Secure Sockets Layer) ensures that all communication between a user’s browser and your server remains private, preventing data interception by attackers. In modern web security, SSL has been largely replaced by TLS (Transport Layer Security), but the term “SSL” is still widely used.

To simplify SSL certificate installation and management, Let’s Encrypt provides free, automated certificates trusted by major browsers. Instead of manually configuring SSL certificates, you can use Certbot, a powerful tool that automates the process of obtaining and renewing SSL certificates from Let’s Encrypt. With Certbot on Ubuntu 24.04, you can quickly set up HTTPS on your Apache server, ensuring encrypted connections with minimal effort.

· · ─ ·𖥸· ─ · ·

How to Set Up Let’s Encrypt SSL on Ubuntu 24.04 with Apache

Prerequisites

  • Ubuntu 24.04 LTS installed and running.
  • A registered domain name pointing to your server.
  • Apache web server installed.
  • Root or Sudo Privileges on your server.

· · ─ ·𖥸· ─ · ·

Step 1: Update Your System

Before starting, make sure your system is up-to-date. Open a terminal and run:

sudo apt update
sudo apt upgrade -y

· · ─ ·𖥸· ─ · ·

Step 2: Install Apache (If Not Already Installed)

If Apache is not yet installed, you can do so with:

sudo apt install apache2 -y

For more information on installing Apache, see the official Apache documentation.

· · ─ ·𖥸· ─ · ·

Step 3: Install Certbot and the Apache Plugin

Certbot helps in obtaining and managing SSL certificates from Let’s Encrypt. Install Certbot and the Apache plugin using:

sudo apt install certbot python3-certbot-apache -y

Learn more about Certbot and its Apache plugin on the Certbot website.

· · ─ ·𖥸· ─ · ·

Step 4: Configure Apache

Prepare your Apache configuration for SSL.

Create or Update Your Virtual Host File

Create a configuration file for your site, e.g., example.com.conf:

Add the following configuration:

sudo vim /etc/apache2/sites-available/example.com.conf 
<VirtualHost *:80> 
ServerAdmin webmaster@example.com 
ServerName example.com 
ServerAlias www.example.com 
DocumentRoot /var/www/html 
ErrorLog ${APACHE_LOG_DIR}/error.log 

CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>

For more details on Apache modules, visit the Apache Modules documentation.

Enable the Site and Required Modules

Enable the site and necessary modules with:

sudo a2ensite example.com.conf 
sudo a2enmod rewrite 
sudo a2enmod ssl

Test and Reload Apache.

Verify the Apache configuration:

sudo apache2ctl configtest
sudo systemctl reload apache2

· · ─ ·𖥸· ─ · ·

Step 5: Obtain and Install an SSL Certificate

Use Certbot to obtain and configure your SSL certificate:

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

Follow the prompts to provide your email address and agree to the terms of service. Certbot will configure Apache to use SSL.

· · ─ ·𖥸· ─ · ·

Step 6: Verify SSL Installation

Check your website using https:// to ensure SSL is working. You should see a padlock icon in the browser’s address bar, indicating that the connection is secure.

· · ─ ·𖥸· ─ · ·

Step 7: Set Up Auto-Renewal

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

Open the cron job editor:

sudo crontab -e

Add the following line to check for renewal twice daily:

0 */12 * * * certbot renew --quiet

Save and exit. This job will renew your certificate and reload Apache if necessary.

· · ─ ·𖥸· ─ · ·

Let’s Encrypt SSL Renewal Automation Flowchart

Automating SSL renewal is crucial to maintaining a secure and uninterrupted HTTPS connection on your Ubuntu 24.04 server. Let’s Encrypt certificates expire every 90 days, but with Certbot’s auto-renewal feature, you can ensure seamless renewals without manual intervention.

How the SSL Renewal Automation Works:

  1. Cron Job Execution – A scheduled cron job triggers the Certbot renewal process at regular intervals.
  2. Certbot Checks Expiry – Certbot verifies if any installed SSL certificates are expiring within the next 30 days.
  3. Renewal Request – If a certificate is nearing expiration, Certbot sends a renewal request to the Let’s Encrypt servers.
  4. Validation Process – Let’s Encrypt validates domain ownership, ensuring the request is legitimate.
  5. New Certificate Issued – Once validated, a fresh SSL certificate is generated and installed.
  6. Apache Reload – To apply the new certificate, the web server (Apache) is automatically restarted or reloaded.
  7. Error Handling & Logging – Any issues encountered during the process are logged, allowing admins to troubleshoot if necessary.

By automating SSL renewal, you eliminate the risk of downtime due to expired certificates. Regularly monitoring renewal logs ensures the process runs smoothly, keeping your website secure and trusted.

· · ─ ·𖥸· ─ · ·

Secure Your Ubuntu 24.04 Server with Automated SSL Renewal

Setting up Let’s Encrypt SSL on Ubuntu 24.04 is just the first step—keeping your certificate valid is what ensures long-term security. With Certbot’s automated renewal, you can rest easy knowing your HTTPS encryption won’t expire unexpectedly. No more last-minute certificate errors or panicked troubleshooting!

Now that your SSL is set up and automated, why stop here? Strengthen your server’s security even further—check out our step-by-step guide on securing Apache on Ubuntu 24.04. Keep your website protected and running smoothly!

Leave a Reply

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

Comments (

)

  1. Paul Tammes

    Marvelous, I love it when a howto just works!

    1. Sam Galope

      Thank you so much for the kind words! I’m thrilled to hear the guide worked perfectly for you. If you have any other projects or questions, feel free to reach out—or check out some of the other guides on my site.

  2. Corbridge

    Thanks – Enjoyed this post, how can I make is so that I receive an email sent to me whenever there is a fresh article?

    1. Sam Galope

      I’m glad you enjoyed the post! To receive email notifications for new articles, you can typically subscribe to the blog’s newsletter or RSS feed. If you’re on the website, there may be an option to sign up for updates. Let me know if you need any help finding that!

  3. Barks

    Hey there! I’ve been following your web site for a while now and finally got the courage to go ahead and give you a shout out from Houston Texas! Just wanted to say keep up the excellent job!

    1. Sam Galope

      Hey there, thanks for reaching out from Houston! I really appreciate your support and kind words. It’s great to know you’ve been following the site, and I’ll definitely keep up the hard work. Thanks again!

  4. DiFrancisco

    Hi this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get advice from someone with experience. Any help would be enormously appreciated!

    1. Sam Galope

      Great question! Most blogs these days use WYSIWYG (What You See Is What You Get) editors, which allow you to write and format content without needing to know HTML. Platforms like WordPress, Wix, and others make it easy to create a blog with drag-and-drop features and visual editing tools.

      However, if you ever want more control over your blog’s design or functionality, learning some basic HTML and CSS can be very helpful. It’s not required for starting a blog, but it’s a nice skill to have down the line. Let me know if you need recommendations for blog platforms or want to learn more about coding!

  5. Foye

    Definitely, what a great blog and illuminating posts, I will bookmark your site.Have an awsome day!

    1. Sam Galope

      Thank you for the kind words! I’m glad you’re enjoying the blog. I appreciate you bookmarking the site—have an awesome day too!

  6. Britt

    Keep this going please, great job!

    1. Sam Galope

      Thank you so much! I’m glad you’re enjoying the content. To stay updated with more posts, be sure to check out our subscription page here. Appreciate your support!