Console9

How to issue an SSL certificate with Certbot for Apache

Obtain and install a free Let's Encrypt SSL certificate on an Apache web server using Certbot's apache plugin.

Obtain a free SSL/TLS certificate from Let's Encrypt and automatically configure HTTPS on an Apache web server using Certbot's --apache plugin.

Prerequisites

  • Ubuntu or Debian server with Apache installed and running
  • A domain name pointing to the server's public IP address
  • Port 80 open in the firewall
  • Certbot installed with the Apache plugin ( sudo apt install certbot python3-certbot-apache)

Step-by-Step: Issue an SSL Certificate with Certbot for Apache

1. Run Certbot with the Apache Plugin

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

Certbot performs the HTTP-01 challenge, obtains the certificate, and modifies the Apache virtual host to enable HTTPS with the correct SSLCertificateFile and SSLCertificateKeyFile directives.

2. Verify HTTPS Is Working

curl -I https://example.com

Common Issues

"Unable to find a virtual host for the domain"— Apache's ServerName or ServerAlias directive does not match the requested domain. Add the domain to the virtual host configuration before running Certbot.