How to configure Nginx with Let’s Encrypt on Debian/Ubuntu Linux

Here’s a high-level overview of the steps to configure Nginx with Let’s Encrypt on a Debian or Ubuntu Linux system:

  1. Install Nginx:
    sudo apt-get update
    sudo apt-get install nginx
  2. Install certbot, the Let’s Encrypt client:
    sudo apt-get install certbot python3-certbot-nginx
  3. Obtain an SSL certificate for your domain:
    sudo certbot --nginx -d example.com -d www.example.com

    Replace example.com with your own domain name. The --nginx option tells certbot to automatically configure Nginx to use the obtained SSL certificate.

  4. Verify that the SSL certificate was correctly installed and Nginx is configured to use it:
    sudo nginx -t

    If the test is successful, reload Nginx to apply the changes:

    sudo systemctl reload nginx
  5. Test your website in a web browser to verify that it is using the SSL certificate and is accessible over HTTPS.

Note: This is a basic setup, and you may need to further customize your Nginx configuration depending on your needs. Additionally, certbot will renew your SSL certificate automatically before it expires, so you don’t have to worry about manual renewal. https://starsoffline.com/

Leave a Comment