The cart is empty

In today's digital world, securing web applications is a necessity. An SSL/TLS certificate is crucial for securing communication between a client and server. Let's Encrypt provides free SSL certificates that can significantly contribute to securing your website. In this article, we'll look at the steps required to install a Let's Encrypt SSL certificate for the Nginx web server on Ubuntu 20.04.

Prerequisites

  • Ubuntu 20.04 server with root access or a user with sudo privileges.
  • Installed and running Nginx.
  • Domain name pointing to your server.

Step 1: Installing Certbot

Certbot is an automated tool for easily installing Let's Encrypt SSL certificates. To install it, run the following commands:

sudo apt update
sudo apt install certbot python3-certbot-nginx

Step 2: Configuring Nginx

Before running Certbot, it's important to have the Nginx server block properly configured for your domain. Ensure that the configuration file for your website (typically located in /etc/nginx/sites-available/ your_domain) contains the correct server_name directives:

server {
    listen 80;
    server_name example.com www.example.com;
    ...
}

Don't forget to test the Nginx configuration and restart the service:

sudo nginx -t
sudo systemctl restart nginx

Step 3: Obtaining and Installing the SSL Certificate

Now that Nginx is ready, we can run Certbot, which will automatically obtain the Let's Encrypt certificate and configure Nginx to use it:

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

Certbot will guide you through the process, which includes agreeing to the terms of service and the option to redirect all HTTP traffic to HTTPS.

Step 4: Verifying Automatic Renewal

Let's Encrypt certificates are valid for only 90 days. Certbot automatically sets up cron jobs or systemd timers for their renewal. You can verify that automatic renewal is correctly set up:

sudo certbot renew --dry-run

If the command runs without errors, automatic renewal is properly configured.

 

You should now have a Let's Encrypt SSL certificate installed and correctly configured on your Nginx server running on Ubuntu 20.04. This not only increases the security of your website but also helps improve user trust and potentially your search engine rankings due to the preference for HTTPS connections.