Installing SSL Certificate on Ubuntu

Installing an SSL certificate on Ubuntu involves several steps, including obtaining the certificate, preparing your server, and configuring the web server to use the certificate. Here are step-by-step instructions for installing an SSL certificate on Ubuntu using the Apache web server as an example.


  • To convert your .cer into different file formats, Utilize our eMudhra utility tool to seamlessly transform your files into .cer, .pfx (.p12), .jks, or .pem formats, and conveniently import zip files using our CSR tool."

Step 1: Upload Certificate to Server

First, copy your certificate files to the directory where you keep your certificate and key files. Typically, this directory is /etc/ssl/ for your certificate.crt and ca_bundle.crt files, and /etc/ssl/private/ for your private.key file.

Step 2: Adjust Apache.config File

Next, you will need to find the Apache configuration file on your server. Typically, you will find the configuration file in /etc/apache2/sites-enabled/your_site_name.

In case you cannot find your configuration file, you can run the following command: sudo a2ensite your_site_name

Once the Apache configuration file is located, you will need to configure the virtual host section of your website. Before you do so, please make sure to create a backup of your current *.conf file. This way, you will be able to undo any changes in case something goes wrong.

A typical Virtual Host file looks like the file below:

DocumentRoot /var/www/site ServerName SSLEngine on SSLCertificateFile /path/to/certificate.crt SSLCertificateKeyFile /path/to/private.key SSLCertificateChainFile /path/to/ca_bundle.crt

The part above highlighted in bold is the one you will need to edit based on the file paths your certificate files are located in. Please make sure the attributes in bold don't have a "#" (comment) prepended; if they do, please remove that symbol to uncomment them.

As mentioned above, you will need to change the file names to match your certificate files and their location on the server:

  • SSLCertificateFile: This is your primary SSL certificate file (certificate.crt)

  • SSLCertificateChainFile: This is your CA-Bundle file (ca_bundle.crt)

  • SSLCertificateKeyFile: This is your private key file (private.key)

To verify whether or not your configuration works, you can run the following command: apachectlConfigtest

Next, save your Apache configuration file and restart your server using one of the commands below:

  • apachectl stop

  • apachectl start

  • apachectl restart

In case something goes wrong along the way, please rest assured that you will be able to revert your Apache configuration file using the backup you have created earlier in the process. This way, you will be able to start over again.

Check Installation

You have completed all the required steps to install your SSL certificate. Verify that the SSL certificate is correctly installed by accessing your website or service using HTTPS. After installing your certificate, it is a good practice to test your SSL setup using various online tools to ensure everything is working correctly.

Last updated

© eMudhra. All Rights Reserved.