安装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
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/diannaorumen/)下载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:inetpubwwwroot
--;
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
那么就成功了。