As we know that SSL stands for Secure Socket Layers and is a public key infrastructure that uses the RSA method of encryption and authentication via security certificates. It helps to establish a secure connection between the client and the server through the secure protocol HTTPS. It is a perfect choice for protecting sensitive information, such as customer contact details and credit card details. Even Google has recently announced the contribution of SSL certificate in the SEO.
There are many ways to integrate SSL certificate in our website especially when it is on Amazon web server but here we will be discussing one of the easiest methods for SSL Installation on AWS EC2 which is a matter of few commands. Without further delays, let’s get started and remember we will be Installing the third party SSL Certificate on AWS Linux EC2 Apache Server.
Following are the steps to install SSL on Amazon AWS EC2
Enable MOD SSL
First of all, we need to enable mod SSL. We can run the following commands to do that
cd /etc/ssl/ sudo a2enmod ssl
Move the certificate files to Amazon server
After enabling mod SSL now we need to change the folder permission in AWS, where we will keep our certificate files.
To change the folder permission Run the following Command.
sudo chmod -R 777 certs/
Now we need to upload or move our certificate files which are, Private Key, Certificate, Full chain from our local machine to the Server.
Following are the sample SCP commands to move those files from local to AWS EC2 Server.
sudo scp -i /home/dell/saran/mytypings.pem /home/dell/Downloads/private_key.key firstname.lastname@example.org:/etc/ssl/certs sudo scp -i /home/dell/saran/mytypings.pem /home/dell/Downloads/certificate.cer email@example.com:/etc/ssl/certs sudo scp -i /home/dell/saran/mytypings.pem /home/dell/Downloads/fullchain.CER firstname.lastname@example.org:/etc/ssl/certs
Update in AWS EC2 SSL conf file
After copying the certificate files to the server now its time to make some changes in AWS EC2 SSL configuration file. So let’s open the following file with the following command
sudo vim /etc/apache2/sites-available/default-ssl.conf
Change the SSL file path location in this file. Give the folder path where the files have been moved earlier. Just have a look on the following a sample code.
SSLCertificateFile /etc/ssl/certs/private_key.key SSLCertificateKeyFile /etc/ssl/certs/certificate.cer SSLCertificateChainFile /etc/ssl/certs/fullchain.CER
Set default SSL conf file for Configuring
Finally, we have to set this SSL conf file as default with the help of following Command and then restart the apache server.
sudo a2ensite default-ssl sudo service apache2 restart