How to Install an SSL in Apache using OpenSSL?
Once your SSL certificate gets issued, you’ll be required to install it on your server to see visible HTTPS URLs. For those who have Apache OpenSSL, go through the steps below and find out how you can install the SSL certificate you issued.
If you don’t have a SSL Certificate, Buy Now at low cost. Before proceed ahead, make sure you have CSR. If you don’t have follow the tutorial to generate CSR in Apache.
Nonetheless, before you begin SSL installation, it’s recommended that you ensure you’ve below-mentioned certificates:
Server Certificate
The server certificate is received from the CA (Certificate Authority) side specifically for your website. You may receive it at your registered email address. If not, you can download it through your Account Dashboard and your SSL order.
Intermediate Certificate
An intermediate certificate is a file that allows devices connecting with your server to learn about the CA that issued an SSL certificate. Likewise, there might be multiple certificates if you’ve got a ZIP certificate folder. In such a folder, intermediate certificates are provided. Likewise, folders are known as CA Bundle.
Private Key
The private key should be kept securely or within your possession on your server. Likewise, if you’ve Microsoft IIS, the private key may not be visible easily to you, but the server may have it.
Note: It’s recommended that the files mentioned above be kept securely on the server directory where all the key and certificate files are stored.
Steps to Install Your SSL Certificate in Apache OpenSSL
Follow the quick steps:
Locate the Config File of Apache & Edit
Find out two main files of Apache that are usually named as:
- apache2.conf
- httpd.conf
Usually, these two files are found in /etc/apache2/ or /etc/httpd.
Note:
The SSL config file may be within another config file of the <VirtualHost> block.
On Linux distribution, you can search for an SSL conf file with the command:
grep -i -r “SSLCertificateFile” /etc/httpd/
Configuring File & Enter Commands
Once you find the file, you’ll be required to configure the httpd.conf file using the mentioned commands on Virtual Host for enabling SSL successfully:
<VirtualHost 192.168.0.1:443>
DocumentRoot /var/www/html2
ServerName www.domainexample.com
SSLEngine on
SSLCertificateFile /path/to/ domain_example_name.crt
SSLCertificateKeyFile /path/to/your_private.key
SSLCertificateChainFile /path/to/cabundle.crt
</VirtualHost>
Note:
If you want to load your website using http and https, you’ll need to create one more virtual host for http, which you can do by simply using the code mentioned earlier.
Once the above steps are completed, it’s recommended that you test the newly updated config file by using the below command:
apachectl
configtest
And if it’s successful, then restart your Apache server using commands:
apachectl stop
apachectl start
You may be required to enter a password when generating your RSA key. Likewise, re-generate the RSA key file if you don’t want to enter any password.
End Words
Once the steps above are completed, you should see HTTPS URLs, as you’ve successfully installed your SSL certificate. Go through the website in your web browser and browse https://www.domain-example.tld and view the installed SSL certificate or site information.