Title: Securing Apache
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Securing Apache

An SSL certificate will provide a secured, encrypted connection to a webserver.  The openssl and httpd packages make this easy to implement.

- Start by ensuring that you have the latest updates for openssl and httpd.

yum install openssl httpd mod_ssl

- Create a CSR as documented in the previous unit.  This will create two files, one a key and the other a certificate signing request.  Send the CSR to a Certificate Authority (CA) and request a certificate in PEM format.
- After the certificate file has arrived, copy the certificate (pem file) and the key (key file) to /etc/httpd/conf.d.  Edit the /etc/httpd/conf.d/ssl.conf file as needed.  For example:

ServerName www.mysite.com:443
SSLCertificateFile /etc/httpd/conf.d/www.mysite.com.pem
SSLCertificateKeyFile /etc/httpd/conf.d/www.mysite.com.com.key

- If you want to use a different DocumentRoot for the ssl files, change all occurances of /var/www/html to /var/www/ssl in /etc/httpd/conf.d/ssl.conf.
  - Also create the /var/www/ssl directory and set permissions to match /var/www/html.
  - Start the httpd service and ensure that you can connect on both ports 80 and 443.