How Do I Install an SSL Certficate on My Linux Server?

How do I install an SSL certficate on my Linux server?

  1. First you need to obtain the SSL certificate. After buying your SSL certificate you'll receive several files from your Certificate Authority (CA), typically including your SSL certificate file and your CA bundle file which you will need to perform the installation. 
  2. Next, upload the SSL certificate files to your Linux server. It's common to place them in /etc/ssl/certs/ or /etc/apache2/ssl/. 
  3. Now you'll need to configure Apache. Open your Apache configuration file for your site. This might be located in /etc/apache2/sites-available/ or /etc/httpd/conf.d/. 
  4. Run the following command:

    sudo nano /etc/apache2/sites-available/your_domain.conf 
  5. Add the following lines to your VirtualHost configuration to specify the paths to your SSL certificate files:

    apache 
    <VirtualHost *:443>
        ServerName your_domain.com
        DocumentRoot /var/www/html 
     SSLEngine on
        SSLCertificateFile /etc/ssl/certs/your_domain.crt
        SSLCertificateKeyFile /etc/ssl/private/your_domain.key
        SSLCertificateChainFile /etc/ssl/certs/ca_bundle.crt 
      <Directory /var/www/html>
            AllowOverride All
    </Directory>
    </VirtualHost> 
  6. Run the following command to enable the SSL module and your site configuration:

    sudo a2enmod ssl 
    sudo a2ensite your_domain.conf 

  7. Restart the Apache service to apply the changes with the following command:

    sudo systemctl restart apache2 

  8. Finally, use an SSL checker tool, such as SSL labs, to check that the SSL certificate is installed correctly.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

Modified on Mon, 16 Sep at 8:41 AM

Can’t find what you’re looking for?

Get in Touch

Do you have a pre-sales question?