SSL certificate helps you improve web traffic between client browser and your server, and increase data security. Here’s how to install SSL certificate on Apache Windows.
How to Install SSL Certificate on Apache Windows
Here are the steps to install SSL certificate on Apache Windows.
1. Enable mod_ssl
mod_ssl is an Apache module required to install and manage SSL/TLS certificates. You can enable it in your Apache server by editing the main server configuration file.
Open Apache server configuration httpd.conf file at c:\Program Files\Apache Software Foundation\Apache2.2\conf\
Uncomment the following lines by removing # at their beginning:
#Loadmodule ssl_module modules/mod_ssl.so #Include conf/extra/httpd-default.conf
Now they should appear as:
Loadmodule ssl_module modules/mod_ssl.so Include conf/extra/httpd-default.conf
Bonus Read : How to Generate CSR for SSL Certificate
2. Get SSL Certificate
Next, get the SSL/TLS certificate bundle from your certificate authority such as Namecheap, RapidSSL, Comodo, GoDadddy, Let’s Encrypt, etc. You can also use a free SSL provider like SSLForFree.
You will get 3 files from certificate authority.
- key (e.g private.key) – your key file. Don’t share this with anyone publicly
- Certificate (e.g certificate.crt) – actual SSL/TLS certificate for your domain
- Ca_bundle (e.g ca_bundle.crt) – Root/intermediate certificate
Bonus Read : How to Redirect non-www to www in Apache
3. Apache SSL Configuration
Now that we have setup the prerequisites, we will configure SSL certificate in Apache
Download the 3 files mentioned in step 2 to c:\Program Files\Apache Software Foundation\Apache2.2\conf\
Next, open Apache SSL configuration file httpd-ssl.conf at c:\Program Files\Apache Software Foundation\Apache2.2\conf\extras
Add the following lines in VirtualHost tag before </VirtualHost> line.
SSLEngine On SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/certificate.crt" SSLCertificateChainFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/ca_bundle.crt" SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/private.key"
You VirtualHost block will look something like this
<VirtualHost _default_:443> DocumentRoot “Your Website's Root folder location” ServerName www.example.com:443 SSLEngine On SSLCertificateFile "/etc/apache2/ssl/certificate.crt" SSLCertificateChainFile "/etc/apache2/ssl/ca_bundle.crt" SSLCertificateKeyFile "/etc/apache2/ssl/private.key" </VirtualHost>
In the above lines, we use 3 Apache server directives
- SSLCertificateFile – Certificate CRT file path
- SSLCertificateKeyFile – Private key file path
- SSLCertificateChainFile – CA bundle file path
Bonus Read : How to Redirect URL to Another URL
4. Test Apache Configuration and Restart Server
Restart Apache Server using its Server Manager
Now you have installed SSL certificate in Apache web server. Open a browser and visit https:// version of your domain (e.g https://www.example.com).
You will see a lock symbol next to your URL, in browser’s address bar, indicating that your website’s SSL/TLS certificate is working properly.
Hopefully, now you can configure SSL certificate in Apache for Windows.