[Apache安装目录]/modules/ mod_ssl.so
[Apache安装目录]/bin/ openssl.exe, libeay32.dll, ssleay32.dll, openssl.cnf
[Apache安装目录]/conf/ openssl.cnf
如果bin下没有openssl.cnf,就从conf中的拷贝进去。
安装ssl证书步骤如下:
一、打开cmd,进入apache的bin目录,执行如下命令:
openssl genrsa 1024 >tian_server.key
(RSA密钥对的默认长度是1024,取值是2的整数次方,并且密钥长度约长,安全性相对会高点)。 完成密钥server.key生产完毕后进行步骤二操作。
二、签署server.csr,执行命令:
openssl req -new -config openssl.cnf -key tian_server.key >tian_server.csr
(如果不加-config .openssl.cnf参数的话,常会报Unable to load config info from .../ssl/openssl.cnf)之后就会要求输入一系列的参数:
Country Name (2 letter code) [AU]:CN ISO 国家代码(只支持两位字符)
State or Province Name (full name) [Some-State]:ZJ 所在省份
Locality Name (eg, city) []:HZ 所在城市
Organization Name (eg, company): 公司名称
Organizational Unit Name (eg, section) []: 组织名称
Common Name (eg, YOUR name) []: 申请证书的域名(建议和httpd.conf中serverName必须一致)
Email Address []:admin@admin.com 管理员邮箱
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: 交换密钥
An optional company name []:
注:Common Name建议和httpd.conf中serverName必须一致,否则有可能导致apache不能启动(启动 apache 时错误提示为:server RSA certificate CommonName (CN) `Kedou' does NOT match server name!? )
完成签署的server.csr配置。
三、签署服务器证书文件server.crt,执行命令:
openssl req -x509 -days 5000 -config openssl.cnf -key server.key -in server.csr >server.crt
说明:这是用步骤 1,2 的的密钥和证书请求生成证书 server.crt,-days 参数 指明证书有效期,单位为天,x509 表示生成的为 X.509 证书。
四、找到server.crt、server.csr、server.key三个文件,将此三个文件剪切到Apache的conf目录下。
五、 在Apache的conf\extra目录下的 httpd_ssl.conf 文件是关于 ssl 的配置,放开如下两项配置:
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
六、在conf/extra目录下,找到httpd_ssl.conf 找到DocumentRoot 改成你当前的站点目录及当前访问的域名ServerName.
最后重启Apache! 经测试成功访问到页面(测试的是v9集成PC_webserver)!
转载请注明:前端录»windows Apache 配置支持HTTPS的SSL证书
<script src="http://www.wozhuye.com/index.php?m=digg&c=index&a=init&id=4-364-2"></script>