Https is very important if you want to make your site secure and trusted by many. If you using Google Chrome you will notice the site that does not have HTTPS will have not secure tags.
To buy HTTPS Certificate is quite expensive if your site is personal use. You also need to renew every 1 or 2 years.
Luckily we can use Letsencrypt. In this tutorial, I’ll be doing some command on Ubuntu 16 and Nginx. For more tutorial you can visit Certbot sites below
First install the repositories required
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
Then install the certbot
sudo apt-get install certbot python-certbot-nginx
I’m using Nginx as my my Web Server as it doesn’t consume much memory. Apache consumes more memory, because each thread consumes a little bit of memory, so if you have 100 threads it will add up. Remember, this is for my personal use.
sudo certbot --nginx certonly
sudo certbot -a dns-plugin -i nginx -d "*.yourdomain.xyz" -d yourdomain.xyz --server https://acme-v02.api.letsencrypt.org/directory
This allow for the wildcard certificate. If you have a new subdomain later on, just run this to add. No need to install the repositories again.
sudo certbot --nginx -d yoursubdomain.example.xyz
To make automatic renewal as the LetsEncrypt certificate only last 90 days, all you need to do is to run this command
sudo certbot renew --dry-run
That’s it. Try it out and if you have some issues let me know.