Install Let's Encrypt SSL Certificate with Nginx on Debian 13

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public's benefit.

To setup Let's Encrypt with Nginx, you will need the below prerequisites.

Prerequisites

To setup Let's Encrypt with Nginx, you will need the below prerequisites.

  • Debian 13 installed and having root access to the system.
  • Domain name with A record pointing to your server's IP address.

Update the System

Before we begin with installating additional packages, we will update the system to latest,

apt dist-upgrade

Install Snapd

Install the snapd package using the below command

apt install snapd

Output:

root@Debian13Server:~# apt install snapd
Installing:                     
  snapd

Installing dependencies:
  dirmngr      gpg             libassuan9          libldap-common            libnpth0t64          pinentry-curses
  gnupg        gpg-agent       libcurl3t64-gnutls  libldap2                  librtmp1             squashfs-tools
  gnupg-l10n   gpg-wks-client  libgcrypt20         liblzo2-2                 libsasl2-2
  gnupg-utils  gpgconf         libgpg-error-l10n   libnghttp3-9              libsasl2-modules
  gnupg1       gpgsm           libgpg-error0       libngtcp2-16              libsasl2-modules-db
  gnupg1-l10n  gpgv            libksba8            libngtcp2-crypto-gnutls8  libssh2-1t64

Update the Snap with below commands,

snap install core; snap refresh core

Install Nginx

apt install nginx

Now, restart & check the nginx with the following commands:

systemctl start nginx
systemctl enable nginx

Installing Certbot

Run the command to install certbot specific to Nginx

snap install --classic certbot

Output:

root@Debian13Server:~# snap install --classic certbot
certbot 4.2.0 from Certbot Project (certbot-eff✓) installed

Execute the following command to ensure that the certbot command can be run.

ln -s /snap/bin/certbot /usr/bin/certbot

Set up a Nginx vHost for the SSL Certificate

Confirm that the Virtual host for your domain is set up and working.

Open the virtual file,

nano /etc/nginx/conf.d/dev.domainhere.info.conf

And add the below configuration to the file,

server {
    listen 80;
    listen [::]:80;

    root /var/www/dev.domainhere.info/public_html;

    index index.html;

    server_name dev.domainhere.info;

    access_log /var/log/nginx/dev.domainhere.info.access.log;
    error_log /var/log/nginx/dev.domainhere.info.error.log;

    location / {
        try_files $uri $uri/ =404;
    }
}

Replace the dev.domainhere.info with your actual domain name in the configuration and the configuration file name.
The web root path is where the application or site resides and can be updated accordingly.

If an error occurs, check for any typos or missing characters and once the syntax is correct, reload the Nginx to load new configuration.

systemctl reload nginx

Set up SSL Certificate

Run this command to get a certificate and have Certbot edit your Nginx configuration automatically to serve it, turning on HTTPS access in a single step.

certbot --nginx -d dev.domainhere.info

Replace the dev.domainhere.info with the actual domain name

You will have to accept the terms of service.

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/dev.domainhere.info/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/dev.domainhere.info/privkey.pem
This certificate expires on 2025-11-12.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for dev.domainhere.info to /etc/nginx/conf.d/dev.domainhere.info.conf
Congratulations! You have successfully enabled HTTPS on https://dev.domainhere.info

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

You will receive this acknowledgement that the SSL certificate for dev.domainhere.info is successfull.

You can now verify your website using https:// that the connection is secure with the lock icon in the usrl bar.

To check that you have a top-of-the-line installation, navigate to https://www.ssllabs.com/ssltest/.

Certbot Auto-Renewal

certbot renew

This concludes setting up and configuring Let's Encrypt for Nginx on Debian 13.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS