`
iversion
  • 浏览: 32884 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

resin 3 配置ssl

    博客分类:
  • tech
阅读更多
   最近要用到resin的ssl,参考网上的资料官方参考文档。经过多次实践后,终于完成了resin的ssl配置。
   要启用resin的SSL功能,只有pro版才支持。普通版配置后会出现诸如没有licence或没有JNI support的警告。
   下面介绍主要针对windows的配置:

  
1.安装resin 下载地址:http://www.caucho.com/
本示例使用的是resin 3.1.3版本,破解版可以看这个


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列表:
  • ssleay32.dll
  • libssl32.dll
  • libeay32.dll

第一个在官方网站上没有说明,但是在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

"C:\Program Files\GnuWin32\bin\openssl.exe"   genrsa -des3 -out gryffindor.key 1024



5.建立gryffindor.crt

"C:\Program Files\GnuWin32\bin\openssl.exe" req -config ./openssl.cnf  -new -key gryffindor.key -x509 -out gryffindor.crt
(以刚才我们写的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 不变。



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics