Install SSL in Apache
The name and location of the config files can differ from server to server particularly if you utilize an extra interface for managing the server configuration.
Apache's principal configuration file is usually known as httpd.conf or apache2.conf. The possible places for this file are httpd//etc/httpdor /etc/httpd or the directory /etc/apache2/. For a comprehensive listing of default installation layouts for Apache HTTPD on various operating systems and distributions, see Httpd Wiki - DistrosDefaultLayout.
Most of the time it is the case that typically, the SSL Certificate configuration is located within a block of an additional configuration file. The configuration files may be under a directory like /etc/httpd/vhosts.d/, /etc/httpd/sites/, or in a file called httpd-ssl. conf.
- Identify the SSL block to set up.
If you want your site to be accessible via secured (https) as well as secure but not secured (http) connections You will require an individual virtual host for both types of connection. Create a backup of your existing non-secure virtual hosting server and then configure it to support SSL following the steps in step 4.
If you are only requiring your website to be accessible securely, then you need to configure the current virtual host to support SSL as explained in step 4.
- Configure the Block for SSL-enabled sites.
Below is a simple example of a host that is configured for SSL. The components highlighted in bold are the ones that need to be included for SSL configuration:
Make sure the file names be consistent with your certificate files:
- SSLCertificateFile is the Certificate file (eg. your_domain_name.crt).
- SSLCertificateKeyFile should be the key file generated when you created the CSR.
- SSLCertificateChainFile should be the intermediate certificate file (XYZ.crt)If the SSLCertificateChainFile directive does not work, try using the SSLCACertificateFile directive instead.
- Check your Apache configuration before restarting.
Set the proper bit length for your CSR.
It is recommended to test your Apache configuration files for problems prior to restarting because Apache won't start up again in the event that your configuration files have syntax errors. The following command can be used: (it is apache2ctl on certain systems)
- Restart Apache.
You can use the apachectl command to stop or start Apache using SSL support:
Note: If Apache doesn't start with SSL support Try with "apachectl startssl" instead of "apachectl start". If SSL support is only available by using "apachectl startssl" we recommend that you modify the apache initial configuration in order to add SSL support when you run the "apachectl start" command. If not, your server might require to be restarted manually Apache with "apachectl startssl" in the case of a server restart. This is usually done by removal of the and tags that contain tags that contain your SSL configuration.