Install SSL Certificate on Ubuntu Server with Apache2

Here’s an easy guide to add Apache2 SSL certificates to your Ubuntu server

It has reached the point where everybody wants to encrypt their website, no matter how big or small a website may be. You must install an SSL / TLS certificate to do so. That is where the problem comes. A good percentage of website administrators are from the non-technical community who might not have heard of SSL, let alone installing it. This is where we get into the frame. We try to help you with your queries regarding SSL / TLS. And this time, we’ve created a blog to let you install an SSL certificate for Apache2 on your Ubuntu server.

Without wasting much time, let’s get straight to the crux of the matter. We thought you went through the process of creating and ordering CSRs. But if you haven’t, use our CSR Generation Guide to easily generate a CSR and purchase an SSL certificate before you update your Ubuntu SSL certificate.

Step 1 : Download your Certificate files and copy them

Next, access the files for intermediates and for certificates. Now transfer them to your folder directory, along with your private key, where you intend to keep your certificate and key information. Don’t forget to just make them readable by heart.

Step 2 : Find the config file in Apache

Ubuntu’s configuration file for Apache2 is most often available at:

/etc/apache2/sites-enabled/your_site_name

If you can’t find it then run the command below.

Now that you have found the file you are searching for, open it with a text editor (such as Notepad) and find the block < VirtualHost > consisting of the configuration for Apache.

Step 3: Determine which SSL block to configure

You now have two options in here. Do you want the secure HTTPS and insecure HTTP access to your website? And, just want HTTPS enabled? You’ll need to build two separate files in /etc / apache2 / sites-enabled/ if you want the former. Another is used for port 80 (HTTP) and one is used for port 443 (HTTPS). If the latter is your choice, simply create a single file.

Step 4: Configure the block to < VirtualHost >

Here is an example of a virtual host file configured as:

<VirtualHost 192.168.0.1:443>

DocumentRoot /var/www/

SSLEngine on

SSLCertificateFile /path/to/your_domain_name.crt

SSLCertificateKeyFile /path/to/your_private.key

SSLCertificateChainFile /path/to/DigiCertCA.crt

</VirtualHost>

To make it clear, this is what the lines of the above command represent:

SSLCertificateFile – Your main certificate file

SSLCertificateKeyFile – Your private key

SSLCertificateChainFile – Your intermediate certificate file

Step 5: Restart your server

Voila! You have successfully installed an SSL certificate on Ubuntu using Apache2.