resin4 配置https

本文介绍如何在 Resin 服务器中配置 OpenSSL 和 JSSE 以支持 SSL 加密连接。首先验证 Resin 是否支持 OpenSSL,并通过编译参数添加支持。接着详细说明了安装 OpenSSL、配置环境变量、删除多余配置文件、上传证书、修改配置文件等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、验证resin是否支持openssl,只要看启动日志就知道了。是否包含openssl

resin本身调用jni,如果编译后添加支持,可以优化resin性能,所以我编译的参数加了jni

1
2
3
Using Resin(R) Open Source under the GNU Public License (GPL).
  See http://www.caucho.com for information on Resin Professional,
  including caching, clustering, JNI acceleration, and OpenSSL integration.

二、需要openssl,resin 本身需要编译支持openssl

1
2
3
4
5
yum install openssl openssl-devel -y
cd resin-4.0.44
./configure --prefix=/usr/local/resin4.0.44 --enable-64bit --enable-ssl --with-openssl=/usr/
make
make install

三、编写env.sh

每个项目都可以有自己的env,这样服务器可以有多个Java版本,多个resin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
JAVA_HOME=/usr/java/jdk1.6.0_33
 
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
 
RESIN_HOME=/usr/local/resin4.0.44
export RESIN_HOME
 
SERVER_ROOT=/home/项目名
LD_LIBRARY_PATH=$RESIN_HOME/lib
#LD_LIBRARY_PATH=$SERVER_ROOT/etc
CLASSPATH=$LD_LIBRARY_PATH:$CLASSPATH
export SERVER_ROOT LD_LIBRARY_PATH CLASSPATH
 
## for linux
#LANG=en_US.iso88591
LANG=zh_CN.gbk
export LANG


四、删除多余的配置文件

删除cluster-default.xml  health.xml 这都是pro版才有的功能


五、上传证书

将生成的csr key或者jks证书上传到 resin/keys 目录下,keys目录如果没有就自己建个


六、修改resin.xml

1
2
3
4
5
6
7
8
9
<http port="443">
  <openssl>
    <certificate-key-file>keys/your_domain.key</certificate-key-file>
    <certificate-file>keys/your_domain.crt</certificate-file>        
    <certificate-chain-file>keys/chain.txt</certificate-chain-file>
    <password>test123</password>
    <protocol>-sslv3</protocol>
  </openssl>
</http>

  jks

1
2
3
4
5
6
7
8
9
<http port="8443">
     <jsse-ssl>
       <key-store-type>jks</key-store-type>
       <key-store-file>keys/server.keystore</key-store-file>
       <password>changeit</password>
     </jsse-ssl>
    </http>
 
    </server-default>

七、或者不动resin.xml,修改resin.properties

1
2
3
4
5
6
7
8
9
10
11
12
# OpenSSL certificate configuration
# Keys are typically stored in the resin configuration directory.
# openssl_file : keys/test.crt
# openssl_key : keys/test.key
# openssl_password : changeme
# openssl_protocols : -sslv2 -sslv3
 
# JSSE certificate configuration
# Keys are typically stored in the resin configuration directory.
# jsse_keystore_type : jks
# jsse_keystore_file : /usr/local/resin4/keys/server.keystore
# jsse_keystore_password : changeme


八、问题

如果遇到如下问题,就是你的证书没有密码或者你密码写错了

jks证书报错:

1
Keystore was tampered with, or passwordwas incorrect

openssl证书报错

1
java.lang.ClassNotFoundException: com.caucho.vfs.OpenSSLFactory

本文转自银狐博客51CTO博客,原文链接http://blog.51cto.com/foxhound/1693132如需转载请自行联系原作者

战狐
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值