resin 3 配置ssl

最近要用到resin的ssl,参考网上的[url=http://blog.csdn.net/vip55092732/archive/2007/02/28/1517233.aspx]资料[/url]和[url=http://www.caucho.com/resin-3.0/security/ssl.xtp]官方参考文档[/url]。经过多次实践后,终于完成了resin的ssl配置。
要启用resin的SSL功能,只有pro版才支持。普通版配置后会出现诸如没有licence或没有JNI support的警告。
下面介绍主要针对windows的配置:


1.安装resin 下载地址:http://www.caucho.com/
本示例使用的是resin 3.1.3版本,破解版可以看[url=http://blog.csdn.net/dj12/archive/2007/12/31/2006709.aspx]这个[/url]


2. 导入ssl dll.
1)安装GnuWin32,完成后拷贝GnuWin32/bin目录下的ssl相关库文件:
C:\> cd %RESIN_HOME%
C:\resin-3.0> copy "C:\Program Files\GnuWin32\bin\libssl32.dll" .\libssl32.dll
C:\resin-3.0> copy "C:\Program Files\GnuWin32\bin\libeay32.dll" .\libeay32.dll

备注:
上面所需dll在resin-pro-3.0.19版本里配置成功。
而resin-pro-3.1.3配置ssl所需要DLL列表:
[list]
[*]ssleay32.dll
[*]libssl32.dll
[*]libeay32.dll
[/list]
第一个在官方网站上没有说明,但是在3.1.3版里如果少了第一个启动时会报错:
com.caucho.config.ConfigException: SSL JNI was not properly initialized.
Make sure the resinssl library is properly created and the SSL libraries

3.在%RESIN_HOME%下建一个 keys 文件夹,%RESIN_HOME%/keys 信件文件openssl.cnf 内容如下

[ req ]
default_bits = 1024
distinguished_name = req_distinguished_name

[ req_distinguished_name ]
C = 2 letter Country Code, for example US
C_default =
ST = State or Province
ST_default =
L = City
L_default =
O = Organization Name
O_default =
OU = Organizational Unit Name, for example 'Marketing'
OU_default =
CN = your domain name, for example www.hogwarts.com
CN_default =
emailAddress = an email address
emailAddress_default =


(PS:在windows下可能新建的这个文件会变成一个快速拨号的快捷方式 不用管它)

4.建立gryffindor.key

[table]
|"C:\Program Files\GnuWin32\bin\openssl.exe" genrsa -des3 -out gryffindor.key 1024|
[/table]


5.建立gryffindor.crt

[table]
|"C:\Program Files\GnuWin32\bin\openssl.exe" req -config ./openssl.cnf -new -key gryffindor.key -x509 -out gryffindor.crt|
[/table](以刚才我们写的openssl.cnf为模板)
备注:在linux下使用openssl建立密钥和证书更方便,下载openssl包并编译安装,完成直接运行相关命令即可。

6.配置resin.conf,指定SSL端口,本示例使用8443,这个可以自定义。
<http port="8443">
<openssl>
<certificate-file>keys/gryffindor.crt</certificate-file>
<certificate-key-file>keys/gryffindor.key</certificate-key-file>
<password>my-password</password>
</openssl>
</http>



7.测试,访问https://localhost:8443

备注:
如果是要移植到linux 上只需要把libssl32.dll libeay32.dll拷贝到RESIN_HOME下,还有keys文件夹拷过去,resin.conf 不变。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值