需要注意的是,编译apache时候必须加入了DSO支持,如果没有,请加入 --enable-module=so 选项重新编译apache
安装resin:
下载resin的安装包
/usr/local
# tar -zxvf resin-2.1.4.tar.gz
/usr/local
# cd resin-2.1.4/bin
/usr/local/resin-2.1.4/bin
# httpd.sh start
如果没有错误消息
看一下http://ip:8080/
能看到resin的页面就表示单独运行resin成功了
下面是比较重要的整合resin和apache
首先编译mod_caucho
下载resin的源代码
/usr/local# tar -zxvf resin-2.1.4-src.tar.gz /usr/local
# cd resin-2.1.4-src /usr/local/resin-2.1.4-src
# ./configure --with-apxs=/usr/local/apache/bin/apxs 或者 /usr/local/resin-2.1.4-src
# ./configure --with-apxs=/usr/local/apache /usr/local/apache为apache的安装路径
然后 /usr/local/resin-2.1.4-src
# make
# make install
修改resin-2.1.4/conf/resin.conf
<http-server>;
<!--
- The root file directory of the server. Apache users will change
- this to /usr/local/apache/htdocs and IIS users will change it
- to d:\inetpub\wwwroot
-->;
<doc-dir>;/usr/local/apache/htdocs/</doc-dir>;
<!-- the http port -->;
这段将doc-dir改成自己的doc dir,我这里是/usr/local/apache/htdocs/
修改httpd.conf
加入
LoadModule caucho_module /usr/local/apache/libexec/mod_caucho.so
AddModule mod_caucho.c
<IfModule mod_caucho.c>;
CauchoConfigFile /usr/local/resin-2.1.4/conf/resin.conf
<Location /caucho-status>;
SetHandler caucho-status
</Location>;
</IfModule>;
重新启动apache和resin
/usr/local/resin-2.1.4/bin/httpd.sh stop
/usr/local/apache/bin/apachectl stop
/usr/local/resin-2.1.4/bin/httpd.sh start
/usr/local/apache/bin/apachectl start
浏览器打开
http://ip/caucho-status/
如果出现
Status : Caucho Servlet Engine
表示没有问题了
测试一下
在/usr/local/apache/htdocs/下面建立一个test.jsp
/usr/local/apache/htdocs# vi test.jsp
<%@page language="java"%>;
2+2=<%=2+2%>;
浏览器打开http://ip/test.jsp
如果能看到
2+2=4
那么就成功了