SSL Certificate Installation in Apache

  1. Download your SSL Certificate i.e. domain_name.crt

    • Login to your account and go to My Account > My Certificates
    • Click Import and download the certificate in PEM Format (.crt)
  2. Download Certificate Chain for Class 3/SSL (PEM Format)
    i.e. Banglaphone_Sub_CA_for_Class_3_Certificate_Chain.crt

  3. Copy the downloaded certificates to the directory on your server where you will keep your certificate and key files. Make them readable by root only

  4. Find the Apache config file to edit. The location and name of this file can vary from server to server.

    Apache configuration files are typically found in /etc/httpd. The main configuration file is usually named httpd.conf. In some cases the <VirtualHost> blocks will be at the bottom of this httpd.conf file. Sometimes you will find the <VirtualHost> blocks in their own files under a directory like /etc/httpd/vhosts.d/ or /etc/httpd/sites/ or in a file called ssl.conf.

    If you open the file with a text editor, you should be able to find <VirtualHost> blocks which contain Apache settings.
  5. Identify the SSL <VirtualHost> block to configure. If you need your site to be accessible through both secure (https) and non-secure (http) connections, you will need a virtual host for each type of connection. Make a copy of the existing non-secure virtual host and configure it for SSL.

    If you only need your site to be accessed securely, configure the existing virtual host for SSL as described next.

  6. Configure the <VirtualHost> block for the SSL-enabled site. The easiest way to do this is to uncomment the following line (i.e. remove the # character) from the httpd.conf file #Include conf/extras/httpd-ssl.conf which has most of the SSL related settings configured out of the box for you. You just have to point the VirtualHost settings to your website, directories and certificate files.
    Below is a very simple example of a virtual host configured for SSL. The parts listed in bold are the parts that must be added for SSL configuration:

    <VirtualHost ip_address:port>
    DocumentRoot /var/www/html2
    ServerName www.yourdomain.com
    SSLEngine on
    SSLCertificateFile /path/to/domain_name.crt
    SSLCertificateKeyFile /path/to/your_private.key
    SSLCertificateChainFile /path/to/Banglaphone_Sub_CA_for_Class_3_Certificate_Chain.crt
    <VirtualHost>

    Note: If the SSLCertificateChainFile directive does not work, try using the SSLCACertificateFile directive instead
  7. Test your Apache config before restarting. It is always best to check your Apache config files for any errors before restarting, because Apache will not start again if your config files have syntax errors. Run the following command: (it is apache2ctl on some systems)

    apachectl configtest

  8. Restart Apache using following commands:

    apachectl stop
    apachectl start

    Note: If Apache does not start with SSL support, try using "apachectl startssl" instead of "apachectl start". If SSL support only loads with "apachectl startssl" we recommend you adjust the apache startup configuration to include SSL support in the regular "apachectl start" command. Otherwise your server may require that you manually restart Apache using "apachectl startssl" in the event of a server reboot. This usually involves removing the and tags that enclose your SSL configuration.