Creating the SSL Certificate
sudo a2enmod ssl
sudo service apache2 restart
Generate a Self-signed Certificate
sudo openssl genrsa -out ca.key 2048
sudo openssl req -nodes -new -key ca.key -out ca.csr
Lastly, generate a self-signed certificate (ca.crt) of X509 type valid for 365 keys.
sudo openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
Create a directory to place the certificate files we have created.
sudo mkdir /etc/apache2/ssl
sudo cp ca.crt ca.key ca.csr /etc/apache2/ssl/
Configure Apache to Use the SSL Certificate:
sudo nano /etc/apache2/sites-enable/000-default.conf
Restart apache
sudo /etc/init.d/apache2 restart