Installing Custom SSL Certificate on Apache

Posted Under: Apache, Configuration, Linux, Security, Snippets on Sep 4, 2018
This configuration snippet will install custom self signed certificate for Apache Web server on Ubuntu.

To Enable self signed certificates on local website follow the instructions below 1) Install OpenSSL
sudo apt-get install openssl
2) Run the following command to generate the self signed SSL certificates:
sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/ssl/certs/server.crt -keyout /etc/ssl/private/server.key
3) Enable SSL Module for Apache
sudo a2enmod ssl
4) Put the default-ssl site available creating a symbolic link
sudo ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/000-default-ssl.conf
5) Edit the file default-ssl.conf
sudo nano /etc/apache2/sites-enabled/000-default-ssl.conf
6) Change the following lines to point to the certs:
SSLCertificateFile    /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
7) Restart Apache to load updated configuration
sudo /etc/init.d/apache2 restart