How to install an SSL certificate on Apache for CentOS or Fedora

DevelopmentCategory
4 min read
Steven Vaughan-Nichols

Did you install an SSL certificate on your CentOS or Fedora server? If not, why take a chance with your website security? With hackers targeting businesses large and small, it just isn’t worth the gamble. Even Google is nudging site owners to up the ante. The search engine grants a higher Google PageRank to those whose sites encrypt the transmissions with the https:// prefix. Now, that type of security requires an X.509 Digital Certificate, commonly referred to as an SSL (Secure Sockets Layer) certificate.

To get started, you’ll first need to acquire a digital certificate, then install it on a CentOS or Fedora server using Apache httpd as the web server. Read on for a bit of background on the certificates and exact steps for installing.

Editor's note: GoDaddy now has a hosting centre located in India, enabling faster load times and better security for customer websites. You can read more here.

Types of SSL digital certificates

A trusted third party called a Certificate Authority (CA) issues the three types of digital certificates: Domain Validation (DV), Organization Validation (OV), and Extended Validation (EV). The CA guarantees the digital certificate's authenticity with a digital signature so that end users (or their software) can trust that the server is really the site it purports to be. Not sure which digital certificate is your best bet? I’ve detailed each below, listing them from least to most secure.

Domain Validation (DV)

Domain Validation certificate states that the domain is registered by someone with admin rights to the website. If the certificate is valid and signed by a trusted CA, a browser connecting to the site will inform you that it has successfully secured an HTTPS connection. A DV is all you need to secure a blog or simple website.

Organization Validation (OV)

An Organization Validation certificate validates the domain ownership and include ownership information such as the site owner's name, city, state, and country.

Extended Validation (EV)

An Extended Validation certificate authenticates the domain ownership and organization information, as well as your organization’s legal existence. This is the go-to certificate for those engaging in e-commerce. In many browsers, you can easily identify websites with an EV SSL certificate by their green address bars.

How to secure the service with an SSL certificate

To get started, you’ll first need to purchase or acquire the SSL certificate.

If you have purchased a CA-approved SSL certificate, delivery might take from hours for a DV to weeks for an EV. The CA will inform you when the certificate is ready for download. Here’s how to retrieve it in seven steps:

  1. Log into Account Manager.
  2. Click SSL Certificates.
  3. Pick the certificate you want to use and click Manage.
  4. Next to the certificate you want to use, in the Actions column, click View Status.
  5. Click Download.
  6. Select the server type, and then click Download Zip File.
  7. Safely store the downloaded file for the future.

How to install an SSL digital certificate for the Apache httpd server on CentOs and Fedora

Installing an SSL digital certificate for the Apache httpd won’t bust the brain. However, if you hit an obstacle on CentOS or Fedora while running through the following steps, drop me a line in the comments section at the bottom of this post.

1. Log in to the server as root using SSH.

2. Check the OpenSSL client software.

Make sure the OpenSSL client software needed for a secure website is in place with:

# yum install mod_ssl openssl

This will either install OpenSSL or inform you that it’s already present.

3. Make a directory to store the server key and certificate.

# mkdir /etc/httpd/ssl

4. Copy the SSL certificate file and server key to the new directory.

5. Edit the ssl.conf or httpd.conf file. Below is an example using the vi text processor.

# vi /etc/httpd/conf.d/ssl.conf

Once open, edit the file so that it points to the correct files in the web server. It will look something like this:

DocumentRoot /var/www/html2
ServerName www.your_very_own_domain.com
SSLEngine on
SSLCertificateFile /path/to/your_very_own_domain.crt
SSLCertificateKeyFile /path/to/your_private.key
SSLCertificateChainFile /path/to/DigiCertCA.crt

Be certain to uncomment any of the above lines, and insert the correct information for the website. If the site uses a version of Apache httpd earlier than version 2.4.8, use:

SSLCertificateChainFile instead of SSLCertificateKeyFile.

6. Check to make sure the Apache configuration files don't contain any errors.

# apachectl configtest

7. Restart the Web server.

Use the following command to restart the Web server:

# /etc/init.d/httpd restart

The secured site should be available at https://www.your_very_own_domain.com.