Install SSL Certificate on Linux Ubuntu/VPS/Nginx
- add repository to system.
sudo add-apt-repository ppa:certbot/certbot
- updating apt.
sudo apt update
- installing certbot
sudo apt-get install python-certbot-apache
// or
sudo apt-get install python-certbot-nginx
- installing SSL by certbot
sudo certbot --nginx -d domainname.com -d www.domainname.com
(Optional)
we need to set auto renew the sertificates by crontab -e
sudo crontab -e
// and add this code deep below: (this will be executed everyday at 1 a.m.)
1 1 * * * certbot renew --post-hook "service nginx restart"
References :