NicSRS
US - English

Web Security Support

SSL Certificate SiteLock

NicSRS API

API

How Can We Help You Today?

How Can We Help You Today How Can We Help You Today
NicSRS > help center > SSL Certificate Installation for Apache

SSL Certificate Installation for Apache

更新时间: 2020-10-16 09:38:25

In this article, let me show you how to install an SSL certificate on Apache web server, one of the most popular web servers.

Step 1: Upload Certificate Files Onto Server

Prepare all your certificate files. The Certificate Authority will email you a Zip-archive with several .crt files. Alternatively, you can download the certificate files in your account.

 

The zip-archive will contain:

 

     .crt file – your primary SSL Certificate for your domain name

     .ca-bundle file – include intermediate certificates. If you uploaded the intermediate Certificates separately onto your server, you will need to use the following command to create a single CA-Bundle file.

 

cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt  >> bundle.crt

 

The example above is for Sectigo PositiveSSL certificate.

Step 2: Locate Apache Configuration File

Depending on the server and OS version, the configuration file may reside in different directories. Look for httpd.conf, apahce2.conf or ssl.conf in one of the following directories: etc/httpd/, /etc/apache2/ or /etc/httpd/conf.d/ssl.conf

 

To learn more different OS versions and the default installation layout of Apache HTTPD, please click Httpd Wiki - DistrosDefaultLayout.

 

The configuration file contains the Virtual Hosts for all domains that are hosted on the server.

 

Note: If you have Apache server installed on the Ubuntu operating system, each site has a separate configuration that can be found at /etc/apache2/sites-enabled/. To have your site accessible via secure and non-secure connection, you will need two separate configuration files: one for port 80 and the other for port 443.

 

Step 3: Configure Virtual Host Section

Once you’ve located the Apache configuration file, you have to configure the virtual host section of your site.

 

First, you are suggested to back up your current configuration file before making any changes. This way you can revert the changes if something goes wrong. So, copy and save your existing *.conf file as *.conf_backup.

 

Now, please edit the Virtual Host. A typical Virtual Host looks like this:

 

<VirtualHost [IP ADDRESS]:443>

ServerAdmin webmaster@nicsrs.com

DocumentRoot /var/www/

ServerName www.nicsrs.com

ErrorLog /www/home/logs/error_log

SSLEngine on

SSLCertificateFile /path/to/ nicsrs_com.crt

SSLCertificateKeyFile/path/to/ nicsrs.key

SSLCertificateChainFile /path/to/ nicsrs_com.ca-bundle

</VirtualHost>

 

Make sure the directives highlighted in bold without no # in front of them. And then, change the file names to match your certificate files and their location on the server:

 

● SSLCertificateFile pointed to the location of the Certificate issued for your domain name

SSLCertificateKeyFile pointed to the location of your Private Key on the server.

SSLCertificateChainFile pointed to the location of the CA-Bundle file.

Step 4: Save & Restart

Test if the new configuration of your Apache service has proper syntax using this command:

apachectl –t

 

If the syntax is OK, save your changes in the configuration file and restart your server.

 

You can use these apachectl commands below to restart Apache:

apachectl stop

apachectl start

apachectl restart

 

If the Apache service fails to restart or the SSL does not get installed, make sure the configuration file is created properly. All you can do is to delete the modified configuration file, revert back to your backup configuration file, and repeat the installation process. Alternatively, you can contact our support team for assistance.

 

Step 5: Test Your SSL Installation

After you install an SSL certificate on Apache, you can confirm the status of your installation by our excellent SSL Checker Tool. The instant scans will discover any potential errors and vulnerabilities that may affect the certificate performance.