阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署
阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署
1、下载resin包
http://caucho.com/download/resin-4.0.48.zip
2、解压
unzip resin-4.0.48.zip -d /etc/
3、启动resin
/etc/resin-4.0.48/bin/resin.sh start
4、访问测试
curl 127.0.0.1:8080
5、探索resin启动
cd /etc/resin-4.0.48/
重启:bin/resin.sh restart 没问题
cd bin
再重启:./resin.sh restart 提示错误:Error: Unable to access jarfile ./../lib/resin.jar
开始探索:
1、注释掉resin.sh的最后一行,并加入下面两行代码
echo `pwd`(输出当前所在目录)
echo $JAVA_EXE -jar ${RESIN_HOME}/lib/resin.jar $*
2、执行命令:./resin.sh start
输出:
/etc/resin-4.0.48(当前所在目录)
java -jar ./../lib/resin.jar start
3、结论:
./../lib/resin.jar = /etc/lib/resin.jar
而resin.jar的实际路径是:/etc/resin-4.0.48/lib/resin.jar,所有才有:Error: Unable to access jarfile ./../lib/resin.jar
4、返回到/etc/resin-4.0.48目录,执行bin/resin.sh start
输出:
java -jar bin/../lib/resin.jar start
/etc/resin-4.0.48
这次:bin/../lib/resin.jar = /etc/resin-4.0.48/lib/resin.jar(看出来没有,这次指向的resin.jar的路径是正确的,所以能正常启动)
5、探索完毕,还原resin.sh
// 上面的配置已经足够部署项目了,下面我们来安装一个resin启动目录
6、依次执行下面的命令
cd /etc/resin-4.0.48/
不指定jdk时:./configure --prefix=/opt/resin(安装目录)
指定jdk时:./configure --prefix=/opt/resin --with-java-home=/usr/lib/jvm/java-1.7.0 --enable-64bit
make
make install
7、启动
先停止前面启动的服务:/etc/resin-4.0.48/bin/resin.sh stop
启动resin:service resin start(安装后就可以这么启动了)
访问下试试:http://ip:8080
查看启动参数配置:cat -n /etc/init.d/resin
8、添加一个14805端口
进入配置目录 cd /opt/resin/conf
vi resin.xml
找到下面这段代码,在它下面拷贝一份
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | < cluster id="app"> <!-- define the servers in the cluster --> < server-multi id-prefix="app-" address-list="${app_servers}" port="6800"/> < host-default > <!-- creates the webapps directory for .war expansion --> < web-app-deploy path="webapps" expand-preserve-fileset="WEB-INF/work/**" multiversion-routing="${webapp_multiversion_routing}" path-suffix="${elastic_webapp?resin.id:''}"/> </ host-default > <!-- auto virtual host deployment in hosts/foo.example.com/webapps --> < host-deploy path="hosts"> < host-default > < resin:import path="host.xml" optional="true"/> </ host-default > </ host-deploy > <!-- the default host, matching any host name --> < host id="" root-directory="."> <!-- - webapps can be overridden/extended in the resin.xml --> < web-app id="/" root-directory="webapps/ROOT"/> </ host > < resin:if test="${resin_doc}"> < host id="${resin_doc_host}" root-directory="${resin_doc_host}"> < web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/> </ host > </ resin:if > </ cluster > |
修改为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | < cluster id="llj"> < server-multi id-prefix="llj-" address-list="${llj_servers}" port="6800"/> < host-default > < web-app-deploy path="webapps" expand-preserve-fileset="WEB-INF/work/**" multiversion-routing="${webapp_multiversion_routing}" path-suffix="${elastic_webapp?resin.id:''}"/> </ host-default > < host-deploy path="hosts"> < host-default > < resin:import path="host.xml" optional="true"/> </ host-default > </ host-deploy > < host id="" root-directory="."> < web-app id="/" root-directory="webapps/ROOT"/> </ host > </ cluster > |
配置端口:
vi resin.properties,添加下面两个属性
1 2 | llj.http = 14805 llj_servers = 127.0.0.1:6801 |
启动服务:/opt/resin/bin/resin.sh --server llj-0 start
访问下试试:curl 127.0.0.1:14805
到现在为止,resin上两个端口8080、14805都启动好了。它们指向的是同一个应用目录,你也可以为它们指定不同的应用目录
9、部署项目
将一个.war文件拷贝到/opt/resin/webapps目录下,再访问下两个端口的服务,显示的是你项目的首页,表示部署成功
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构