Resin4+Apache2.2

1.安装JDK、Apache并设置相应环境变量

2.下载resin-4.0.23.tar.gz,解压到D:\resin-4.0.23并在环境变量中添加RESIN_HOME指向resin的安装目录,运行D:\resin-4.0.23\setup.exe(若不能运行则拷resin-3.1.11.rar版本中的setup.exe过来)弹出:

3.确定Resin Setup后,D:\Apache2.2\conf\httpd.conf文件中会被添加:

LoadModule caucho_module "D:/resin-4.0.23/win32/apache-2.2/mod_caucho.dll"

...

  #<IfModule mod_caucho.c>
    ResinConfigServer 127.0.0.1 6800
    #CauchoStatus yes
    <Location /caucho-status>
      SetHandler caucho-status
    </Location>
  #</IfModule>

apache收到jsp请求时,通过插件模块mod_caucho交给Resin处理
若路径为...apache-2.0/mod_caudho.dll请将其改为apache2.2

D:\resin-4.0.23\conf\resin.xml

resin也是同样的指定6800端口
<!-- define the servers in the cluster -->
<server id="" address="127.0.0.1" port="6800"></server>
执行D:\resin-4.0.23\resin.exe,在ie输入:http://localhost/caucho-status,如果6800是绿色的,说明整合成功。

3.配虚拟主机
修改Hosts文件为:    127.0.0.1            localhost test.site.com 3g.site.com

去除:\Apache2.2\conf\httpd.conf中#Include conf/extra/httpd-vhosts.conf及#ServerName e.g.www.somenet.com:80==>ServerName 127.0.0.1:80的注释
resin的官方网站提示,假如要用到一个ip对应多个虚拟主机最好注释#ResinConfigServer localhost 6800,ResinConfigServer指令添加到相应的虚拟主机中

\Apache2.2\conf\extra\httpd-vhosts.conf中添加
<VirtualHost localhost:80>(<VirtualHost *:80>不知有什么区别)
ServerAdmin root@localhost.com
DocumentRoot d:\deploy\mobile #程序发布目录
ServerName site.com #网站域名
    ServerAlias 3g.site.com #网站中其它应用名称及目录位置
ResinConfigServer 127.0.0.1 6800 #服务器监听端口
ErrorLog logs/3g-error.log
CustomLog logs/3g-access.log common
</VirtualHost>

\resin-4.0.23\conf\resin.xml中添加
<host id="3g.site.com" root-directory=".">
    <web-app id="/" document-directory="d:\deploy\mobile"/>
  <servlet-mapping url-pattern='/servlet/' servlet-name='invoker'/>
</host>

参考:
http://www.caucho.com/resin-4.0/admin/starting-resin-apache.xtp
http://blog.itpub.net/post/38354/474753/
原文地址:https://www.cnblogs.com/wen12128/p/2263257.html