欢迎光临
我们一直在努力

Resin配置SSL说明-JSP教程,Java技巧及代码

建站超值云服务器,限时71元/月

resin配置ssl说明

daan

1.0

2004-12-22

说明:

为resin服务器配置ssl的访问功能,有几种方法[1]:

1.       在unix下使用openssl。(http://www.openssl.org/)

2.       使用sun的jsse。(http://java.sun.com/products/jsse)

3. …

我们这里介绍第二种方法,在windows 2000下的实现。

 

 

 

准备工作:

1.       windows 2000 server。

2.       j2sdk 1.4.x。(已经包括了jsse)

3.       resin 2.1.x。

4.       jsse中keytool用法[2]。

 

 

 

步骤:

1.       创建一个服务器证书

a)         下面讲如何使用sun的keytool来生成一个服务器证书。看下图:

一般来说,keystore密码和mykey主密码应该设置成一样的。

这时,证书文件已经保存在本例中的c:\resin-2.1.11\keys erver.keystore

2.       配置resin(resin.conf)

resin的ssl配置需要对<http-server>进行扩展,增加几个新的元素。下表中红色文字为新增部分。其中,key-store-file为上一步中生成的证书文件存放地址(相对resin根目录),key-store-password为上一步中为证书设置的密码。

<caucho.com>

    <security-provider id=com.sun.net.ssl.internal.ssl.provider/>

 

<!– declare a new http server on port 443 (standard port for https),

      – with ssl enabled –>

 

<http-server>

  <app-dir>doc</app-dir>

 

  <!– the http port –>

  <http port=80/>

 

  <!– the srun port, read by both jvm and plugin –>

  <srun host=localhost port=6802/>

 

  <http port=443>

    <ssl>true</ssl>

     <key-store-file>keys/server.keystore</key-store-file>

     <key-store-password>yourpasswordhere</key-store-password>

  </http>

 

 

 

测试:

使用上面的配置,启动resin服务,我们可以访问https://localhost。

一个最快的测试方式是新建一个内容如下的jsp文件并访问他:

secure? <%= request.issecure() %>

 

 

 

运行/bin/httpd.exe,结果如下:

访问https://localhost/,跳出一个安全警报,选择是。

(如果不想跳出这个安全警报,有几点要做:1 将证书安装到客户端的ie中;2 证书生成时的cn(即名字与姓氏)必须使用服务器的机器名,即dns名。)

 

 

 

浏览器浏览https://localhost/,效果如下:

浏览https://localhost/issecure.jsp测试文件

这表示我们配置resin使用ssl成功。

参考资料:

[1] ssl configuration: http://localhost/ref/ssl-quick.xtp

以及ssl with resin: http://www.caucho.com/resin-3.0/security/ssl.xtp

[2] java keytool 工具的作用及使用方法: http://www.ccw.com.cn/htm/center/prog/02_7_8_4.asp

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Resin配置SSL说明-JSP教程,Java技巧及代码
分享到: 更多 (0)

相关推荐

  • 暂无文章