Get Free SSL Certificate from Let’s Encrypt for your website - Linux, Apache, EC2, Heroku.

To enable HTTPS on your website, you need a certificate from a Certificate Authority (CA). Let’s Encrypt is a nonprofit Certificate Authority providing Free SSL certificates to 225 million websites. 
You can also get a (absolutely) free SSL certificate using Certbot. Certbot is open-source software tool recommended by Let's Encrypt to for automatically deploy SSL certificate.
This certificate is as valid as a paid certificate.

There are two ways to get and install certificate on your server.
1. When you have SSH access to your server. Then you have option to Generate and Deploy SSL certificate automatically by installing Certbot on your server.
2. When you are using a platform like Heroku (Paas) where you don't have SSH access to your server directly and can't install any package on it. In this case you can install Certbot at your local system (Linux) using below commands and use it only to generate certificate files. Later you can Deploy them manually.

Install Certbot and Generate Certificate

Install Certbot following below commands:
sudo apt-get update
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install certbot python3-certbot-apache sudo apt-get install software-properties-common
when generating certificate on same server, it deploy automatically
sudo certbot --apache
when want to generate certificate only, and to be deployed on other server.
sudo certbot certonly --manual [--apache --preferred-challenges dns]
Following the prompts by Certbot provide your domain name (when asked) for which you want to generate SSL i.e. yourdomain.com. In case you want to generate wildcard SSL, you can provide : *.yourdomain.com, yourdomain.com
terminal
Give your agreement by pressing Y when asked for Are you OK with your IP being logged?

Now it will provide you a TXT DNS record to add on your DNS provider (PointDNS in case of Heroku) like as below:
Please deploy a DNS TXT record under the name _acme-challenge.yourdomain.com with the following value something like below:
I4RsG_YWzJQOAbuthWXu9GiQcvzu1ppcWNDScS3Ypl4
(Add TTL as 1 or as minimum possible so that it reflect As soon as possible.)

Now get back to the terminal and press enter to proceed. It may give multiple DNS TXT records to add, then simple repeat above process to add DNS.

At end it will show you like :

ssl certificate

Once certificate is generated successfully it will show you success message and the path where the certificates are kept as shown in above image.

Deploy on Heroku

Let's Deploy/Update SSL certificate to Heroku app using Apache server. First Login to heroku CLI:
heroku login
Once login successfully, run command to Add/Update SSL certificate:
sudo heroku certs:add /etc/letsencrypt/live/yourdomain.com/fullchain.pem /etc/letsencrypt/live/yourdomain.com/privkey.pem --app=yourappname
Incase you renew or update SSL certificate after expiring old one.
sudo heroku certs:update /etc/letsencrypt/live/yourdomain.com/fullchain.pem /etc/letsencrypt/live/yourdomain.com/privkey.pem --app=yourappname

Comments

Popular posts from this blog

Using Virtual Columns in Laravel - Accessors and Appends

How to Show Cookie Policy Consent or GDPR Popup in Laravel using Cookie.

Postman Collection Run - How to Test File Uploading API on CircleCi or Jenkins