您的位置:首页 > 运维架构 > Linux

Linux Resin 4安装配置

2013-10-12 11:49 375 查看
Resin,是一个非常流行的application server,对servlet和JSP提供了良好的支持,性能优良,resin自身采用Java语言开发。Resin Pro版本支持缓存和负载均衡。

1, Resin 下载Resin 官方下载网址, 最新版下载 resin-4.0.36.tar.gz(免费版)resin 安装需要提前配置好jdk,下载最新版 JDK7(1)Linux环境配置JDK环境变量:JAVA_HOME=/usr/local/jdk1.6.0_32
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
测试java环境:

[root@test2 conf]# java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.4 20100726 (Red Hat 4.4.4-13)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2, Resin 安装(1) 解压tar.gz tar zxvf resin-4.0.36.tar.gzcd resin-4.0.36(2) 安装resin ./configure --prefix=/usr/local/resin-4.0.36 --with-java-home=/usr/local/jdk1.6.0_32 --enable-64bit
makemake install
3, Resin 验证启动 resin: ./bin/resin.sh start开机自启动: vi /etc/rc.local 添加下行命令:/usr/local/resin-4.0.36/bin/resin.sh start[root@test2 bin]# ./resin.sh start
Resin/4.0.36 launching watchdog at 127.0.0.1:6600
Resin/4.0.36 started -server 'app-0' with watchdog at 127.0.0.1:6600
表示 启动成功在浏览器里输入: http://localhost:8080/


点击resin-admin, 报错403拒绝


因为我用浏览器远程访问的,此时需要修改/usr/local/resin-4.0.36/conf 目录下的 resin.properties 文件,去掉 web_admin_external : true 前面的 ‘#’,就可以了




出现以上页面就好了,此时需要注册管理员账号
注册后,默认生成了/usr/local/resin-4.0.36/conf/admin-users.xml.generated




注册提交后,出现以上页面,
进入其目录,把文件admin-users.xml.generated修改为admin-users.xml,可以看到远程访问进行的操作

然后以管理员账号登陆,出现以上监控页面
注: 如果部署到无GUI界面的系统上(如 Ubuntu-server、 CentOS、Solaris等),无法通过浏览器访问本地 resin-admin,则需要修改 resin.properties ,开启远程访问权限:




4, 部署 web(1)拷贝自己的项目例如:MyPro,到/usr/local/resin-4.0.36/webapps/目录下(2) 修改resiin配置文件: vi conf/resin.xml在节点“host id”下,添加一行“web-app”,指向自己的项目(MyPro),id为项目的虚拟目录,例如:api

验证方法,在浏览器里输入: http://localhost:8080/api

resin4配置之一个resin下多个app的正确配置方法

一.同一个域名下多个子app,根据url层级来指向,例如: http://www.test.com与http://www.test.com/demo/二.多个域名对应指定的host,根据域名来指向,例如: http://www.test1.com与http://www.test2.com第一种的配置方法:
<cluster id="app">
<!-- define the servers in the cluster -->
<server-multi id-prefix="app-" address-list="${app_servers}" port="6801"/> <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"/>
<web-app id="/demo" root-directory="webapps/demo"/>
</host>

</cluster>
第二种的配置方法:
<cluster id="app">
<!-- define the servers in the cluster -->
<server-multi id-prefix="app-" address-list="${app_servers}" port="6801"/> <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>
<!--每个host id下也可以包含多个web-app,参考第一种的配置方法-->
<host id="www.test1.com" root-directory=".">
<web-app id="/" root-directory="webapps/test1/ROOT"/>
</host> <host id="www.test2.com" root-directory=".">
<web-app id="/" root-directory="webapps/test2/ROOT"/>
</host> </cluster>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Linux 安装配置 Resin 4