SSL is currently on of the standards of web security. Learn how to implement an SSL certificate on an Apache Web Server to keep your data safe.
Save the primary and intermediate certificates to a folder on the server with the private key. Open the Apache configuration file in a text editor. Apache configuration files are usually found in /etc/httpd. The main configuration file is usually named httpd.conf. In most cases the blocks will be at the bottom of this httpd.conf file. To configure SSL, Apache HTTP must be compiled with modssl. I’ll use CentOS 7 VM from Digital Ocean to demonstrate this. Login to Linux server with root and download the latest version of Apache wget http://www-us.apache.org/dist//httpd/httpd-2.4.25.tar.gz.
Join the DZone community and get the full member experience.
Join For FreeBefore you start the installation process, please make sure that a CSR Code is generated, all validations are met, and the SSL Certificate is issued and downloaded.
To Install an SSL Certificate, Perform the Following Steps:
- Copy the certificate into the shell text editor and name the file “mydomain.crt”
Note: Copy the contents of the certificate from (and including) the -----BEGIN CERTIFICATE----
line to the ---END CERTIFICATE---
line.
- Copy the certificate to the Apache Server Directory in which you plan to store your certificates (by default: /usr/local/apache/conf/ssl.crt/ or /etc/httpd/conf/ssl.crt/)
Note: - If you have a custom installation, please locate the server directory.
- Open the Apache Configuration file in a text editor. Apache configuration files are usually found in /etc/httpd. The main configuration file is usually named httpd.conf. In most cases, the <VirtualHost> blocks will be at the bottom of this httpd.conf file. Sometimes you will find <VirtualHost> blocks in a separate file in a directory like /etc/httpd/sites/ or in a file called ssl.conf.
- Locate the SSL VirtualHost associated with your certificate. Verify that you have the following two directives within this virtual host. Please add them if they are not present.
- SSLCertificateFile /usr/local/apache/conf/ssl.crt/domainname.crt (or server.crt)
- SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/domainname.key (or server.key)
Note: Some instances of Apache will store Virtual Host information in an ssl.conf file. If your httpd.conf contains no Virtual Host information then you will need to locate and amend the ssl.conf as performed above.
- Save the changes and exit the shell editor.
By default:
/usr/local/apache/bin/apachectl startssl
or
/usr/local/apache/bin/apachectl restart
Apache Web Server Configuration Ssl Enable
Apache Web Server Ssl Configuration Manager
Published at DZone with permission of Kalpesh Patel. See the original article here.
Opinions expressed by DZone contributors are their own.