Previously we have discussed HTTPS secures the communication between visitors and web servers. We will show you how to use Certbot to obtain a free SSL certificate for Nginx on Ubuntu and set up your certificate to renew automatically.
- your server is Ubuntu,
- a website with registered domain name, e.g tiliamtech.com, and
- your webserver is Nginx
Add the PPA (Personal Package Archives) to your list of repositories and install Certbot
$ sudo apt-get update $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:certbot/certbot $ sudo apt-get update $ sudo apt-get install python-certbot-nginx
Obtaining an SSL CertificateObtaining an SSL Certificate
sudo certbot --nginx -d tiliamtech.com -d www.tiliamtech.com
This runs certbot with the –nginx plugin, using -d to specify the domain. Running this command will get a certificate for you and have Certbot edit your Nginx configuration automatically to serve it.
Renew certificate automatically
The Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let’s Encrypt certificates last for 90 days, it’s highly advisable to take advantage of this feature. You can test automatic renewal for your certificates by running this command:
$ sudo certbot renew --dry-run