Complete guide – LetsEncrypt Certbot SSL for Ubuntu

Update Libraries before installation

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update

Installation of certbot

For Apache-based Setup

sudo apt-get install certbot python-certbot-apache

For NGInx-based Setup

sudo apt-get install certbot python-certbot-nginx

Generate Certificate

For Apache

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

When asked to auto-redirect the traffic to https, select 2

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

For NGInx

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

Setup Auto-renewal in Cron

env EDITOR=nano crontab -e
15 3 * * * /usr/bin/certbot renew --quiet

Remove Certificate

sudo certbot delete --cert-name example.com

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.