Close Menu
  • Home
  • Life style
    • Celebrities
    • Exercise & Training
    • Healthline
  • Exploration
    • Beauty tips
    • Business
    • Travel guides
    • Fashion
    • Technology
  • Web tutorials
    • Hosting & Servers
    • Blogger guides
    • WordPress guides
  • English
    • Tiếng Việt
    • Hmoob
    • English
Facebook YouTube X (Twitter) Instagram
Trending
  • Late-Summer Travel in Vietnam 2026: Plan a Less Crowded, Less Rainy Itinerary
  • Protecting WordPress Against AI Bots and Unknown Crawlers
  • Install Let’s Encrypt SSL on Ubuntu with OpenLiteSpeed and Automatic Renewal
  • AI-Powered Operational Optimization for Small Businesses: A 30-Day Testing Framework
  • Optimizing a Blog for Google AI Overviews and AI Mode
  • Diagnosis and Treatment of Severe Pneumonia: CAP, HAP, VAP, and Aspiration Pneumonia
  • How to Build a Newsletter for Your Blog: WordPress, Substack, or an Email Platform?
  • Repurposing Blog Content: Turn One Article into 5 Formats
Facebook YouTube X (Twitter) Instagram
SaibABCSaibABC
Chú thích cho quảng cáo
  • Home
  • Life style
    1. Celebrities
    2. Exercise & Training
    3. Healthline
    4. View All

    Comparing Lionel Messi and Cristiano Ronaldo: Their Complete Careers

    30/08/2026

    Celebrities Move to Video Podcasts: The New Era of Talk Shows

    30/08/2026

    Taylor Swift Protects Her Voice Against AI: The Fight Against Deepfakes

    30/08/2026

    15 Most Popular Celebrities in the World of All Time

    30/08/2026

    Five-Minute Office Exercises: A Snack-Sized Movement Schedule

    30/08/2026

    Best Exercises to Strengthen Your Core: From Beginner to Advanced

    30/08/2026

    Diagnosis and Treatment of Severe Pneumonia: CAP, HAP, VAP, and Aspiration Pneumonia

    30/08/2026

    Preventing Dengue at Home: A Mosquito Control and Severe Symptom Checklist

    30/08/2026

    Self-Directed Health with Wearables: Use Data Correctly, Do Not Self-Diagnose

    30/08/2026

    Empowering Health: Prioritize Early Cancer Screenings for Better Well-being

    30/08/2026

    Diagnosis and Treatment of Severe Pneumonia: CAP, HAP, VAP, and Aspiration Pneumonia

    30/08/2026

    Preventing Dengue at Home: A Mosquito Control and Severe Symptom Checklist

    30/08/2026

    Preparing for the Business Peak Season: Capacity, Staffing, and Cash Flow Spreadsheet

    30/08/2026

    Comparing Lionel Messi and Cristiano Ronaldo: Their Complete Careers

    30/08/2026
  • Exploration
    1. Beauty tips
    2. Business
    3. Travel guides
    4. Fashion
    5. Technology
    Featured

    Late-Summer Travel in Vietnam 2026: Plan a Less Crowded, Less Rainy Itinerary

    By Nuj Coom30/08/2026
    Recent

    Late-Summer Travel in Vietnam 2026: Plan a Less Crowded, Less Rainy Itinerary

    30/08/2026

    AI-Powered Operational Optimization for Small Businesses: A 30-Day Testing Framework

    30/08/2026

    How to Block OTA Updates on iPhone and iPad Using Block OTA

    30/08/2026
  • Web tutorials
    1. Hosting & Servers
    2. Blogger guides
    3. WordPress guides
    4. View All

    Install Let’s Encrypt SSL on Ubuntu with OpenLiteSpeed and Automatic Renewal

    30/08/2026

    How to Install the LAMP Stack: Linux, Apache, MySQL, and PHP on Ubuntu

    30/08/2026

    How to secure Apache with Let’s Encrypt on Ubuntu

    30/08/2026

    What Is LAMP Stack? Discover the Power of LAMP Stack

    30/08/2026

    Optimizing a Blog for Google AI Overviews and AI Mode

    30/08/2026

    Repurposing Blog Content: Turn One Article into 5 Formats

    30/08/2026

    12 Best AI Content Writing Tools for Bloggers in 2026

    30/08/2026

    How to Get Your Blog Into Google Discover After the Google Discover Core Update 2026

    30/08/2026

    Protecting WordPress Against AI Bots and Unknown Crawlers

    30/08/2026

    How to Install the LAMP Stack: Linux, Apache, MySQL, and PHP on Ubuntu

    30/08/2026

    12 Best AI Content Writing Tools for Bloggers in 2026

    30/08/2026

    Check WordPress Plugins Before Updating: A 24-Hour Process

    30/08/2026

    Protecting WordPress Against AI Bots and Unknown Crawlers

    30/08/2026

    Install Let’s Encrypt SSL on Ubuntu with OpenLiteSpeed and Automatic Renewal

    30/08/2026

    Optimizing a Blog for Google AI Overviews and AI Mode

    30/08/2026

    How to Build a Newsletter for Your Blog: WordPress, Substack, or an Email Platform?

    30/08/2026
  • English
    • Tiếng Việt
    • Hmoob
    • English
SaibABCSaibABC
Home»Web tutorials»Hosting & Servers»How to secure Apache with Let’s Encrypt on Ubuntu
Hosting & Servers 6 Mins ReadNo Comments

How to secure Apache with Let’s Encrypt on Ubuntu

Nuj CoomBy Nuj CoomUpdated:30/08/2026
Facebook Twitter Pinterest LinkedIn Tumblr Email
Chú thích cho quảng cáo

Contents

  1. Introduction
  2. Prerequisites
  3. Step 1 — Install Certbot
  4. Step 2 — Check Apache VirtualHost Configuration
  5. Step 3 — Open HTTP and HTTPS on the Firewall
  6. Step 4 — Issue and install a TLS certificate
  7. Step 5 — Check Certbot automatic renewal
  8. Conclusion
  9. References

Introduction

Let’s Encrypt is a free Certificate Authority (CA) that issues TLS certificates to encrypt the connection between a browser and a web server. Certbot is an ACME client used to request, install, and automatically renew certificates. With the Apache plugin, Certbot can find the appropriate VirtualHost, add the TLS configuration, and reload Apache after installation (according to the Ubuntu Server documentation).

In this guide, you will use Certbot to obtain a free certificate for Apache on Ubuntu 22.04 or Ubuntu 24.04, configure HTTPS, and test automatic renewal.

This article uses a separate VirtualHost file for the website instead of editing Apache’s default configuration. This approach gives each domain an independent configuration while preserving the default configuration as a fallback.

Prerequisites

To follow this guide, you need:

  • An Ubuntu 22.04 or Ubuntu 24.04 server with a non- rootuser, administrative access through sudo , and a configured firewall. You can refer to the Ubuntu server setup guide.
  • A registered domain. In this article, the example domain is your_domain.
  • DNS records pointing to the server’s public IP address:
    • An A record for your_domain.
    • An A record for www.your_domain.
  • Apache installed with a VirtualHost for the domain, such as /etc/apache2/sites-available/your_domain.conf. See also how to install Apache on Ubuntu.
  • TCP port 80 must be accessible from the Internet during HTTP-01 validation; port 443 must be open so users can access HTTPS (according to the Ubuntu Server documentation).

Step 1 — Install Certbot

Certbot can be installed from several sources. For modern Ubuntu releases, the Ubuntu documentation recommends installing Certbot from Snap to receive a version updated independently of the APT package cycle.

Chú thích cho quảng cáo

If Snap is not yet installed on the server, install snapdit:

sudo apt update
sudo apt install snapd

Then install Certbot and create a command symlink in /usr/bin:

sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

If Certbot was previously installed from APT, consider removing the old version before switching to Snap to avoid command and renewal mechanism conflicts:

sudo apt remove certbot python3-certbot-apache

Check the installed version:

certbot --version

Step 2 — Check Apache VirtualHost Configuration

To automatically obtain and install a certificate, Certbot must find the correct VirtualHost in the Apache configuration. The domain name is taken from the ServerName and ServerAlias directives in the VirtualHostblock.

Open the domain’s VirtualHost file:

sudo nano /etc/apache2/sites-available/your_domain.conf

Make sure the file contains similar lines:

/etc/apache2/sites-available/your_domain.conf

...
ServerName your_domain
ServerAlias www.your_domain
...

If you have just changed the configuration, check the syntax:

sudo apache2ctl configtest

The expected result is Syntax OK. If there are no errors, reload Apache:

sudo systemctl reload apache2

Check that the VirtualHost is enabled and Apache is listening on the required ports:

sudo a2ensite your_domain.conf
sudo apache2ctl -S

Step 3 — Open HTTP and HTTPS on the Firewall

If you use UFW, allow SSH, HTTP, and HTTPS. Do not close port 80 before completing certificate issuance, because Let’s Encrypt’s HTTP-01 method needs to access the server through this port. UFW is the default firewall tool on Ubuntu (according to the Ubuntu Server documentation).

sudo ufw status
sudo ufw allow OpenSSH
sudo ufw allow 'Apache Full'

Check the list of application profiles if the Apache Full profile does not exist:

sudo ufw app list

You can also open the two web ports directly:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Check the status again:

sudo ufw status

If you previously allowed an HTTP-only profile, you can remove the old rule after confirming Apache Full activity:

sudo ufw delete allow 'Apache'

Step 4 — Issue and install a TLS certificate

Run Certbot with the Apache plugin and specify all domains that need protection:

sudo certbot --apache -d your_domain -d www.your_domain

Certbot will ask for an email address to send security notifications and renewal reminders, and will also ask you to accept the terms of service. Enter an active email address and answer the interactive questions as needed.

Certbot will usually ask whether you want to redirect all HTTP traffic to HTTPS. For a public website, choosing the redirect option is generally appropriate, as long as the application does not need to keep HTTP available separately.

After completion, the certificate files are typically located at:

/etc/letsencrypt/live/your_domain/fullchain.pem
/etc/letsencrypt/live/your_domain/privkey.pem

fullchain.pem contains the server certificate and the intermediate certificate chain; privkey.pem is the private key. Do not share or grant read access to the private key to unnecessary users (according to the Ubuntu Server documentation).

Certbot will also create or update the HTTPS configuration for Apache, usually with a -le-ssl.confsuffix, and then reload the service. Open the website using https:// to confirm that the browser receives a valid certificate.

You can use SSL Labs Server Test to check the certificate and TLS configuration through an external service.

Step 5 — Check Certbot automatic renewal

Let’s Encrypt certificates are currently valid for 90 days and are designed to be renewed automatically on a regular basis (according to the Ubuntu Server documentation). Do not wait until the expiration date is near to renew them manually.

The Certbot version installed from Snap sets up a systemd timer to attempt renewal twice a day. Check the timer with the command:

sudo systemctl status snap.certbot.renew.timer

If the timer is not running, you can enable and start it:

sudo systemctl enable --now snap.certbot.renew.timer

Run a test of the renewal process without changing the certificate currently in use:

sudo certbot renew --dry-run

If the result indicates that the simulated renewal attempts were successful, the configuration is ready. When necessary, Certbot will renew the certificate, and the Apache plugin will reload Apache after a successful renewal. If the website is behind a network firewall, load balancer, or cloud provider, make sure that ports 80 and 443 are also allowed at that network layer.

Conclusion

You have installed Certbot, checked the Apache VirtualHost, opened the necessary web ports, issued a Let’s Encrypt TLS certificate, and verified the automatic renewal mechanism. After enabling HTTPS, check both the primary domain and the domain www, and monitor Let’s Encrypt warning emails so that renewal errors can be addressed promptly.

References

  • Ubuntu Server — Obtain TLS certificates
  • Ubuntu Server — Firewall and UFW
  • Ubuntu Server — Install Apache2
  • Let’s Encrypt — Shorter Certificate Lifetimes and Rate Limits

Chú thích cho quảng cáo
Apache Certbot HTTPS Let’s Encrypt Linux SSL Ubuntu
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous Article12 Best AI Content Writing Tools for Bloggers in 2026
Next Article How to Install the LAMP Stack: Linux, Apache, MySQL, and PHP on Ubuntu
Nuj Coom
  • Website
  • Facebook
  • X (Twitter)
  • Instagram

Related Posts

Install Let’s Encrypt SSL on Ubuntu with OpenLiteSpeed and Automatic Renewal

30/08/2026

How to Install the LAMP Stack: Linux, Apache, MySQL, and PHP on Ubuntu

30/08/2026

What Is LAMP Stack? Discover the Power of LAMP Stack

30/08/2026
Add A Comment
Leave A Reply Cancel Reply

Latest posts

Check WordPress Plugins Before Updating: A 24-Hour Process

PDRN, Peptides, and Biotech Cosmetics: How to Read Advertising Critically

Skincare While Losing Weight: Keep Skin More Hydrated, Healthy, and Firm

How to care for your scalp at home for healthier hair and a complete beauty routine

How to choose mineral sunscreen that does not leave a white cast

Advertisement
Chú thích cho quảng cáo

SUBSCRIBE TO UPDATES

Get the latest creative news from SaibABC.Com on web tips, design, and business.

Copyright © 2024. Designed by NujCoom.
  • Home
  • Contact
  • Privacy
  • Tiếng Việt
  • Hmoob

Type above and press Enter to search. Press Esc to cancel.