从openssl源文件里拷贝
ssl.conf 到 apache/conf/. 也可以下载 http://www.raibledesigns.com/tomcat/ssl.conf 。
在 httpd.conf的最后增加以下指令
# see http://www.modssl.org/docs/2.4/ssl_reference.html for more info
sslmutex sem
sslrandomseed startup builtin
sslsessioncache none
errorlog logs/ssl.log
loglevel info
# you can later change "info" to "warn" if everything is ok
<virtualhost www.my-server.dom:443>
sslengine on
sslcertificatefile conf/ssl/server.crt
sslcertificatekeyfile conf/ssl/server.key
</virtualhost>
如果配置文件里ifdefine指令有效,则运行apache的时候要加上 -d ssl 参数。
注意: 使用多个虚拟主机的时候,必须用基于ip的配置,因为ssl需要配置一个指定端口443,如果使用了基于名字的指令(对于所有端口)则apache服务器会报错
[error] virtualhost _default_:443 -- mixing * ports and non-* ports with a namevirtualhost address is not supported, proceeding with undefined results
启动apache服务器,如果顺利的话你会看到
d:\apache>apache -d ssl
[tue oct 19 22:18:32 2004] [warn] loaded dso d:/apache/php/sapi/php4apache.dll u
ses plain apache 1.3 api, this module might crash under eapi! (please recompile
it with -deapi)
apache/1.3.31 (win32) mod_ssl/2.8.19 openssl/0.9.7d php/4.3.6 running...
如果不能正确启动,仔细看屏幕提示,你会从中得到解决的办法。
如果一切顺利,那么,打开ie,访问https://localhost
参考文档和相关链接:
http://raibledesigns.com/wiki/wiki.jsp?page=apachessl
http://www.yesky.com/softchannel/72356686970486784/20030807/1719982_2.shtml
http://hunter.campbus.com/
http://www.cygwin.com/