Tuesday, August 14, 2012

apache self signed key on windows 8

When using apache 2.2 windows version, here is the step to create key:
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout www.example.com.key -out www.example.com.cert
(the solution is from http://superuser.com/questions/226192/openssl-without-prompt)
And copy the .key and .cert to apache/conf
Then edit httpd.conf:
1. uncomment "LoadModule ssl_module modules/mod_ssl.so"
2. uncomment "Include conf/extra/httpd-ssl.conf"
And edit httpd-ssl.conf:
1. uncommnet "SSLPassPhraseDialog  builtin"
2. use this line: SSLSessionCache         "dbm:C:/Program Files (x86)/Apache Software Foundation/Apache2.2/logs/ssl_scache"

Use icon tool to restart it. If success, you can see https://yourhost/ shows "It works".
If it's not working, check logs/error.log for the failure reason.