How to Install a SSL Certificate on Apache

Get Your SSL Installed on Your Ubuntu Server. I bought mine from NameCheap and they lacked in their documentation on how to generate CSR. I thought this could help others.

This is a short walk through on how to install an SSL on Ubuntu. 

1. Generate CSR

openssl req -new -newkey rsa:2048 -nodes -keyout mydomain.key -out mydomain.csr

2. Find Your CSR

cat mydomain.csr

3. Enable SSL

sudo a2enmod ssl

4. Upload the SSL certificate files (.crt and .ca-bundle) to your server to the /etc/ssl/ folder and move the private key file (.key) to /etc/ssl/private/ for your convenience.

5. Make a replica of the configuration file

cp /etc/apache2/sites-available/your_website.conf
/etc/apache2/sites-available/your_website-ssl.conf

6. Open the configuration file and add the SSL Certificate File Lines

<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/

SSLEngine on
SSLCertificateFile /etc/ssl/example_com.crt
SSLCertificateKeyFile /etc/ssl/private/example_com.key
SSLCertificateChainFile /etc/ssl/example_com.ca-bundle
</VirtualHost>

7. Enable the SSL Configuration and Reload Apache. 

sudo a2ensite your_website-ssl.conf
sudo service apache2 reload