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-apacheorsudo apt-get install python-certbot-nginx
  • installing SSL by certbot
sudo certbot --nginx -d domainname.com -d www.domainname.com
  • Next, 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"

I wrote these tutorials for myself in future when I forget for the next steps.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store