GlassFish服务器如何配置SSL的安全证书?

发布时间:2018/6/6 13:18:04 打印 字号:

GlassFish Server 默认支持https访问方式,下面介绍下如何添加Gworg证书:


步骤1 ,

 cd  C:\Program Files\Java\jdk1.7.0_45\bin


步骤2 , 生成keystore文件,命令如下

keytool -genkeypair -keyalg RSA -keystore custom_store.jks -validity 365 -alias custom

会依次提示设定CN=hostname, OU=custom, O=custom, L=dl, ST=dl,C=cn

keytool命令是"%JAVA_HOME%"\bin下的,提前设置环境变量。

CN尽量使用访问的PC名称,其余的随意即可。

custom 自定义一个标识符(使用步骤2定义的即可)。

custom_store 自定义一个store名称。

365 过期时间。


步骤3 ,

 keytool -export -alias custom -file custom_name.crt -keystore custom_store.jks

custom 自定义一个标识符(使用步骤2定义的即可)。

custom_name 自定义一个证书名称。

changeit 随便定义个。


步骤4, 修改%glassfish_home%\domains\teras_domain\config下的domain.xml文件

<jvm-options
>-Djavax.NET.ssl.keyStore=${com.sun.aas.instanceRoot}/config/custom_store.jks</jvm-options>


步骤5, 可选操作,将Gworg证书追加到jre的security的keystore中。

keytool -import -%JAVA_HOME%\jre\lib\security\cacerts -file custom_name.crt-alias custom

如果cacerts拒绝访问,则需要用管理员身份启动命令行窗口