If you’re running a Debian 10 server with Apache and still serving your site over plain HTTP, you’re basically shouting your traffic across the internet. That’s bad news for logins, contact forms, and anything even slightly private.
This hits small business sites, WordPress installs, and any DIY server where HTTPS was put off as “later”. The good news: with Let’s Encrypt and Certbot, you can get a free SSL certificate and wire it into Apache with minimal drama.
In this guide, we’ll walk through securing Apache on Debian 10 with Let’s Encrypt, using Certbot and a proper virtual host file.
What You Need Before You Touch SSL
Before fighting with certificates, get the basics right. Skipping these is how you end up staring at mysterious Certbot errors at 2 AM.
You should have:
- A Debian 10 server with sudo access
- You need a non-root user that can run
sudoand a firewall already in place. - A registered domain name
- The tutorial assumes
your_domainas the domain. - You can use any registrar (Namecheap, Freenom, whatever you already have).
- DNS pointing to your server
Set up these A records to your server’s public IP: your_domain→ your server IPwww.your_domain→ your server IP
Certbot needs this so it can prove your server really serves that domain.- Apache already installed and serving your site
- Apache should be installed on Debian 10.
- You should already have a virtual host file for your domain, for example:
/etc/apache2/sites-available/your_domain.conf - The tutorial uses that path as the example.
If any of these are missing, fix them first. SSL will not work correctly if DNS or the Apache vhost is wrong.
Step 1: Use a Separate Apache Virtual Host File
On Debian/Apache, it’s normal to be tempted to just edit the default Apache config. Don’t. Using a separate vhost file per domain saves you headaches.
The idea here is simple:
- Keep
/etc/apache2/sites-available/000-default.confas a fallback. - Create and use
/etc/apache2/sites-available/your_domain.conffor your domain.
Why this matters:
– You avoid mixing multiple sites into one file.
– Debugging becomes easier when each domain lives in its own config.
You should already have that file created from the Apache-on-Debian-10 setup. Just keep in mind that Certbot will work with that vhost file when it injects SSL settings later.
Step 2: Install Certbot on Debian 10
Let’s Encrypt gives the certificates, but Certbot does the dirty work: requesting, installing, and wiring them into Apache.
On Debian 10, Certbot is not available from the standard Debian software repositories. That means you can’t just apt install certbot from Debian’s own repo and call it a day.
You’ll need to follow the recommended way (from the original tutorial’s context) to get Certbot for Debian 10. The key takeaway from the source is:
- You must install Certbot separately, not from the default Debian repo.
- Once installed, Certbot can fully automate issuing and installing certificates for Apache.
Because the exact install commands are not included in the source summary, I won’t invent them here. Just be aware:
- Step one in the SSL journey is installing Certbot properly on Debian 10.
- After that, everything else (certificate request, Apache config, renewal) is driven by Certbot.
Step 3: Use Certbot to Get a Let’s Encrypt Certificate
Once Certbot is installed, it becomes your main tool to talk to Let’s Encrypt.
Conceptually, Certbot will:
- Connect to Let’s Encrypt (the Certificate Authority).
- Prove that your server really serves
your_domain(using HTTP validation). - Obtain a free TLS/SSL certificate for that domain.
- Store the certificate and private key on your server.
Important detail from the source:
The entire process of obtaining and installing a certificate is fully automated on Apache.
So for Apache on Debian 10, once Certbot is installed correctly, you basically:
- Run Certbot for Apache.
- It figures out your existing vhost for
your_domain. - It updates Apache configs for HTTPS for you.
No manual virtual host editing for SSL should be needed if Certbot can see and understand your existing /etc/apache2/sites-available/your_domain.conf file.
Step 4: Let Certbot Configure Apache for HTTPS
The source tutorial is built around this idea: Let Certbot do the Apache changes instead of hand-editing SSL directives.
Here’s what happens during that process in simple terms:
- Certbot reads your Apache config
- It scans the virtual host file for
your_domain. - It understands which site should get HTTPS.
- It adds the HTTPS virtual host
- Certbot sets up a new vhost for port 443 using your new certificate.
- It keeps your existing HTTP vhost to handle redirects.
- It can enable HTTP→HTTPS redirection
- You’ll usually have the option to force all traffic to HTTPS.
- This is what you want for almost all normal sites.
- Apache is reloaded with the new config
- Certbot makes the changes.
- Then it reloads or restarts Apache so the new SSL config takes effect.
Why this is nice:
– You don’t have to remember SSL directives, certificate paths, ciphers, or protocols.
– It lowers the chance of typos that break Apache.
Step 5: Set Up Automatic Certificate Renewal
Let’s Encrypt certificates are intentionally short-lived. That’s good for security, annoying for humans. Certbot solves this by handling renewals automatically.
From the source:
You will use Certbot to obtain a free SSL certificate for Apache on Debian 10 and set up your certificate to renew automatically.
That means:
- Once the initial certificate is in place, Certbot can periodically check and renew it before it expires.
- You don’t need to manually request a new certificate every few months.
Under the hood, Certbot typically:
- Runs on a schedule (for example via a cron job or timer, depending on how it was installed).
- Talks to Let’s Encrypt again, uses the same validation mechanism, and grabs a fresh certificate.
- Updates the certificate files Apache is already using.
- Reloads Apache so the renewed certificate is active.
So as long as:
- Certbot is installed the recommended way for Debian 10, and
- You’ve successfully issued the first certificate, and
- Apache can still serve
your_domainandwww.your_domaincorrectly,
…your site will stay covered with HTTPS without you babysitting it.
Safety Notes and Common Gotchas
A couple of practical things from a sysadmin perspective, especially if you’re doing this on a live site:
- Work with sudo, not root
- The initial server setup expects a non-root user with sudo.
- This is standard best practice so you don’t accidentally wreck the system.
- Respect your virtual host structure
- Keep each domain in its own file under
/etc/apache2/sites-available/. - Avoid throwing everything into the default config; it makes Certbot’s life harder and debugging painful.
- DNS must be correct before using Certbot
- Both
your_domainandwww.your_domainmust point to the server IP. - Let’s Encrypt’s verification will fail if DNS is wrong, slow to update, or pointing somewhere else.
- Firewall must allow web traffic
- Since you already followed the initial Debian 10 server setup with a firewall, make sure HTTP/HTTPS are open.
- If web traffic is blocked, Certbot can’t validate your domain.
- Test on a staging or low-traffic window if you’re nervous
- While Certbot’s Apache automation is usually smooth, it does touch live config.
- If this is a production site, do it when traffic is low.
Wrap-up: What You Get After Doing This
Once you’ve followed the original tutorial’s flow, your Debian 10 + Apache setup should have:
- A clean virtual host file for
your_domain(and default config as fallback). - Certbot properly installed from the recommended source (not from Debian’s regular repo).
- A working Let’s Encrypt SSL certificate for
your_domainandwww.your_domain. - Apache automatically configured to serve HTTPS, with optional HTTP→HTTPS redirect.
- Automatic renewal via Certbot so you don’t have to remember expiry dates.
That’s a solid, modern baseline for any Apache site on Debian 10.
If this saved you time, bookmark CrushEdge for more fixes.
No Comments