Apache2 ssl windows

October 12th, 2008

To enable https for your site using VirtualHost follow the following steps.

  1. Download Apache 2.2.9 with openssl (MSI Installer) from http://httpd.apache.org/download.cgi
  2. Execute the installer and follow the instructions.
  3. Make sure Apache is installed properly by pointing your web browser to http://127.0.0.1/ or http//localhost/.
  4. If you are using default Apache installation directory, navigate to c:\program files\apache software foundation\apache2.2\conf.
  5. Execute:
    openssl req -config openssl.cnf -new -out domainname.csr -keyout domainname.pem
    to create a .pem key.
  6. Execute:
    openssl rsa -in domainname.pem -out domainname.key
    to create a .key key.
  7. Delete .rnd file.
  8. Execute:
    openssl x509 -in domainname.csr -out domainname.cert -req -signkey domainname.key -days 365
    to create .cert key.
  9. Create a directory called ssl in the conf directory. Move all keys (cert,csr,key,pem) to the newly created directory.
  10. Edit httpd.conf.
  11. Uncomment line that says:
    LoadModule ssl_module modules/mod_ssl.so.
  12. Uncomment line that says:
    Include conf/extra/httpd-ssl.conf
  13. Edit extra\httpd-ssl.conf.
  14. Under directive <VirtualHost _default_:443>, edit DocumentRoot and ServerName to reflect your site name.
  15. Point SSLCertificateFile to conf/ssl/domainname.cert
  16. Point SSLCertificateKeyFile to conf/ssl/domainname.key
  17. Modify options under <Directory> directives as required.

To know more about what each command does refer to http://www.neilstuff.com/apache/apache2-ssl-windows.htm.