1. Knowledge base
  2. Initial Setup
  3. Install Let’s Encrypt SSL on Debian 8…

Install Let’s Encrypt SSL on Debian 8 with Nginx webserver

Updated on 18 November 2019 3 min read Snel.com support team

Introduction

In this tutorial, you will learn the procedure of TLS/SSL certificate installation on Nginx web server running Debian 8 Jessie. Once you are finished, all traffic between server and client will be encrypted and safe. This is a standard practice of securing e-commerce websites and other financial services online.

Prerequisites

Before you begin working with this guide you’ll need these:

  • SSH with root access or sudo user access.
  • The Nginx web server with properly a domain and vhost configured.

Step 1 — Installing Let’sEncrypt certbot

The first step to using Let’s Encrypt to obtain an SSL certificate is to install the certbot Let’s Encrypt client on your server. To install run this:

Code
sudo apt-get install certbot

Step 2 — Create and install the SSL certificates

Certbot will handle the SSL certificate management quite easily, it will generate a new certificate for a provided domain as a parameter.

In this case, example.com will be used as the domain for which the certificate will be issued:

Code
sudo certbot certonly --webroot -w /var/www/example -d example.com -d www.example.com

IMPORTANT! The first domain should be your base domain, in this sample it’s example.com
While installing the certificate you will be presented with a step-by-step guide which will let you customize certificate details. You will be able to choose between forcing HTTPS or leaving HTTP as the default protocol, providing an email address will be required as well for security purposes.

You may also do this with the auto-installation of the certbot by running:

Code
sudo certbot --authenticator webroot --installer nginx

Step 3 — Check the SSL certificate(s) configuration

At the above stage, your certificate created and configured. Now check if your domain virtual host configuration file is in accordance with the SSL below. If not, then put this manually on virtual hosts SSL configuration:

Code
...listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com www.example.com ssl_certificate /etc/letsencrypt/live/<your-domain>/cert.pemssl_certificate_key /etc/letsencrypt/live/<your-domain>/privkey.pem...

Now we need to test our configuration.

Code
sudo nginx -t

Finally, restart Nginx and You can taste that your SSL is working.

Code
sudo systemctl reload nginx

Step 4 — Setting up for the auto-renewal

The Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let’s Encrypt certificates last for 90 days, it’s highly advisable to take advantage of this feature. You can test automatic renewal for your certificates by running this command:

Code
sudo certbot renew --dry-run

Conclusion

Congratulations! You have just secured your Nginx web server by implementing the most anticipated security feature – free SSL certificates. From now on all traffic between your domain web server and client is secure, you can be assured that no one could intercept the communication and alter or steal crucial information.

Was this article helpful?

Spot a mistake in this article? Email us at support@snel.com

This article was last checked on 18 November 2019. · 4,271 views

Your own VPS online within 2 minutes

Windows or Linux, root access and hosted in Rotterdam.

View VPS from € 6.99

Support

Can't figure it out? We are happy to help

You always talk to a real engineer. We typically respond within 15 to 30 minutes, and 24/7/365 for outages.

Call us

+31 88 3 088 099

Create a ticket

Through the client area we immediately see which service it is about.

Email us

Send your question via the contact form, also outside office hours.