Author :
Nupur Bhatt
Open Ubuntu Terminal, enter the following commands :

Type sudo apt-get install apache2 to install Apache.

Step One—Activate the SSL Module
The next step is to enable SSL on the droplet.
Follow up by restarting Apache.

Step Two—Create a New Directory
We need to create a new directory where we will store the server key and certificate
Step Three—Create a Self Signed SSL Certificate
When we request a new certificate, we can specify how long the certificate should remain valid by changing the 365 to the number of days we prefer. As it stands this certificate will expire after one year.With this command, we will be both creating the self-signed SSL certificate and the server key that protects it, and placing both of them into the new directory.
The most important line is "Common Name". Enter your official domain name here or, if you don't have one yet, your site's IP address.

Step Four—Set Up the Certificate
To set up the virtual hosts to display the new certificate,
open up the SSL config file: sudo nano /etc/apache2/sites-available/default-ssl.

Within the section that begins with <VirtualHost _default_:443>, quickly make the following changes. Add a line with your server name right below the Server Admin email:
ServerName example.com:443
Replace example.com with your DNS approved domain name or server IP address (it should be the same as the common name on the certificate). Find the following three lines, and make sure that they match the extensions below:
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt SSLCertificateKeyFile /etc/apache2/ssl/apache.key Save and Exit out of the file.

Step Five—Activate the New Virtual Host
Before the website that will come on the 443 port can be activated, we need to enable that Virtual Host:
sudo a2ensite default-ssl
Restarting your Apache server will reload it with all of your changes in place. sudo service apache2 reload

In the browser, type https://127.0.0.1, and you will be able to see the new certificate.
Click on Add Exception. Click on View certificate.
