Main Contents

Convert IIS SSL Cert to Apache

November 27, 2009

Export your SSL Cert to a PFX file and include the private key. Copy it to your apache server.

# openssl pkcs12 -in www.yourdomain.com.pfx -nocerts -out www.yourdomain.key.pem
# openssl pkcs12 -in www.yourdomain.com.pfx -clcerts -nokeys -out www.yourdomain.cert.pem
# openssl rsa -in www.yourdomain.key.pem -out www.yourdomain.key

Copy contents of www.yourdomain.cert.pem between and including BEGIN CERTIFICATE and END CERTIFICATE into www.yourdomain.cert.

Here’s a sample apache virtualhost config file that includes redirecting the non-SSL site to the new SSL site:

<VirtualHost *:80>
 ServerName www.yourdomain.com
 Redirect permanent / https://www.yourdomain.com/
</VirtualHost>

<VirtualHost *:443>
 ServerName www.yourdomain.com
 DocumentRoot /var/www/html
 <Directory /var/www/html>
  AllowOverride All
 </Directory>
 SSLEngine on
 SSLCertificateFile /path/to/www.yourdomain.cert
 SSLCertificateKeyFile /path/to/www.yourdomain.key
</VirtualHost>

Filed under: Linux, Microsoft, Uncategorized, Windows |

Sorry, the comment form is closed at this time.