How to install lets encrypt ssl certificate on aws ec2 linux instance with apache server
I decided to remove load balancer as i was incurring significant charges because of it , the problem propped up as I was getting free ssl certificate through aws certificate manager.
As soon as I removed load balancer and changed the routing polices , my website was no longer encrypted with ssl. To solve it I decided to install lets encrypt ssl certificate using certbot , this article will discuss how to do the same in easy steps :
1) Open your command prompt or terminal and ssh into your aws instance
2) I have decided to use pip for installing it,
3) Create a virtual environment named certbot virtualenv ~/.certbotsource ~/.certbot/bin/activate4) Finally install certbot :pip install certbot5) After installing create certificate for your website using the below commandsudo ~/.certbot/bin/certbot certonly --webroot -w /var/www/html -d www.yourlocale.in -d yourlocale.inReplace with your own website domainThis will ask few questions , agree to the terms and provide the email address and finally your certificate will be generated showing the path of the key and certificate , keep a note of this as we will use this.6) Our next Step is to enable TLS on the server this can be easily done using the below command:sudo yum install -y mod24_sslThis will create a ssl configuration file named ssl.conf in httpd folder inside config.d folder our next task is to edit this file7) To edit file assuming you are in root directorysudo vi /etc/httpd/conf.d/ssl.confpress iand find certificate and key path , replace it with the one you earlier noted downpress esc and :wq to save and quit the file8) Finally restart the apache serversudo service httpd restart9)You must be sure that in your instance security group you are listening to port 432 and allowing request from all ips.Finally you have completed all the steps and your website supports secure connection, once the certificate expire usually in 3 months we can simply renew it using the following commandsudo ~/.certbot/bin/certbot renewThank You , feel free to reach out in case of any difficulties.

Comments
Post a Comment