How to Install SSL Certificate to an Apache Web Server
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.
Join the DZone community and get the full member experience.Join For Free
Before 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.
Published at DZone with permission of Kalpesh Patel. See the original article here.
Opinions expressed by DZone contributors are their own.