需要注意的是,編譯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
那麼就成功了。