Install Certbot using below commands,

**Edit the below file, **

sudo nano /etc/apt/sources.list

**Add the below line at bottom to the list, **

    deb stretch-backports main
sudo apt update
sudo apt install python-certbot-apache -t stretch-backports

Commands to setup SSL Certificate,
Edit the below file (replace filename with your configuration file name.)

sudo nano /etc/apache2/sites-available/

Add the below line,


Configuration testing,

sudo apache2ctl configtest
sudo systemctl reload apache2

Commands to allow secure connection (HTTPS) through the firewall,

sudo ufw status
sudo ufw allow 'WWW Full'
sudo ufw delete allow 'WWW'
sudo ufw status

Commands to obtain an SSL Certificate,

sudo certbot --apache -d -d

Select an option (1. No redirect or 2. Redirect) and enter to finish the process.
Commands to Certbot Auto-renewal verification,

sudo certbot renew --dry-run