SSL Certificates with Apache on CentOS 7
This guide will show you how to enable SSL to secure websites served through Apache on CentOS or Fedora.
Before You Begin
This guide assumes that you are running Apache2 on CentOS or Fedora. Prior to starting this guide, ensure that the following steps have been taken on your Linode:- Familiarize yourself with our Getting Started guide and complete the steps for setting your hostname and timezone.
-
In order to configure your Apache server to function with SSL, you will need to ensure that the Apache
mod_ssl
module is installed on your system. You can do so by running the following command:
Configure Apache to use the SSL Certificate
- Edit the virtual host entries in the /etc/httpd/conf.d/ssl.conf file to include the certificate files and virtual host information that should be used by each domain. For each virtual host, replicate the configuration shown below. Replace each mention of example.com with your own domain.
If you’re using a commercially signed certificate and you’ve manually downloaded the root CA cert to /etc/pki/tls/certs, ensure that the SSLCACertificateFile value is configured to point to the root certificate directly. If the root certificate is being provided via the “ca-certificates” bundle, you can simply exclude the SSLCACertificateFile line.- /etc/httpd/conf.d/ssl.conf
1 2 3 4 5 6 7 8 9 10 11 12
<VirtualHost *:443> SSLEngine On SSLCertificateFile /etc/pki/tls/certs/example.com.crt SSLCertificateKeyFile /etc/pki/tls/private/example.com.key SSLCACertificateFile /etc/pki/tls/certs/root-certificate.crt ServerAdmin info@example.com ServerName www.example.com DocumentRoot /var/www/example.com/public_html/ ErrorLog /var/www/example.com/logs/error.log CustomLog /var/www/example.com/logs/access.log combined </VirtualHost>
-
Restart Apache:
# systemctl restart httpd
Comments
Post a Comment