Secure Website with Let's Encrypt on Ubuntu

Prerequisites

To complete this guide, you will need:

1. Installing Certbot

sudo apt-get update
#For Nginx
sudo apt-get install python3-certbot-nginx 

#For Apache
sudo apt-get install python3-certbot-apache 

2. Set Up the SSL Certificate on Nginx

vi /etc/nginx/sites-available/default

Find the existing server_name line and replace the underscore, _, with your domain name:

Obtaining an SSL Certificate on Nginx

3. Set Up the SSL Certificate on Apache

Find the existing ServerName line. It should look like this:

Obtaining an SSL Certificate on Apache

4. Verifying Certbot Auto-Renewal

Let’s Encrypt certificates only last for 90 days.

To test the renewal process, you can do a dry run with certbot:

Copy

If you want to run certbot renew with daily schedule,

5. Generating The Wildcard SSL Certificate

IMPORTANT NOTES:

  • Congratulations! Your certificate and chain have been saved at:

    /etc/letsencrypt/live/test/fullchain.pem

    Your key file has been saved at:

    /etc/letsencrypt/live/test/privkey.pem

    Your cert will expire on 2021-09-06. To obtain a new or tweaked

    version of this certificate in the future, simply run certbot

    again. To non-interactively renew all of your certificates, run

    "certbot renew"

  • If you like Certbot, please consider supporting our work by:

    Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donatearrow-up-right Donating to EFF: https://eff.org/donate-learrow-up-right

Reference

https://certbot.eff.org/docs/arrow-up-right

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04arrow-up-right

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04arrow-up-right

Last updated