一、安装依赖包
1
2
3
4
5
6
7
8
9
10
11
|
yum
install
–y gcc gcc-c++
make
cmake openssl openssl-devel ncurses-devel libxml2-devel libgcrypt libgcrypt-devel libxslt libxslt-devel pcre-devel perl
1>.安装apr
tar
zxvf apr-1.4.6.
tar
.gz
cd
apr-1.4.6
.
/configure
--prefix=
/usr/local/apr
make
&&
make
install
2>.安装apr-utils
tar
zxvf apr-util-1.4.1.
tar
.gz
cd
apr-util-1.4.1
.
/configure
--prefix=
/usr/local/apr-util
--with-apr=
/usr/local/apr
make
&&
make
install
|
二、安装Apache
下载:http://apache.dataguru.cn/httpd/
1
2
3
4
|
tar
zxvf httpd-2.4.4.
tar
.gz
cd
httpd-2.4.4
.
/configure
--prefix=
/usr/local/apache
--with-apr=
/usr/local/apr
--with-apr-util=
/usr/local/apr-util/
--
enable
-modules=all --
enable
-so
make
&&
make
install
|
三、安装JAVA环境
1
2
|
tar
zxvf jdk-7u17-linux-
tar
.gz
mv
jdk-7u17-linux
/usr/local/jdk
|
设置环境变量:
1
2
3
4
5
6
7
|
vi /etc/profile
JAVA_HOME=/usr/local/jdk
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JAVA_HOME PATH CLASSPATH
source /etc/profile
java -version #显示版本配置成功
|
四、安装Resin
下载resin:http://www.caucho.com/download/
1
2
3
4
5
|
tar
zxvf resin-4.0.37.
tar
.gz
cd
resin-4.0.37
.
/configure
--prefix=
/usr/local/resin
--with-java-home=
/usr/local/jdk
--with-apxs=
/usr/local/apache/bin/apxs
make
&&
make
install
cp
/usr/local/apache/binapacectl
/etc/init
.d
/httpd
|
./configure报错解决:使用date -s设置系统日期和当前时间
make报错:configure: error: Apache /usr/local/apache/bin/apxs is not a valid apxs script
解决:yum install perl,再修改bin/apxs文件,把第一行改为#!/usr/bin/perl -w 即可!
make出现好多这样报错:
/usr/local/apache/include/apr_hash.h:78: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/apache/include/apr_hash.h:107: error: expected ')' before '*' token
将apr和apr-util包含的头文件都复制到apache下解决:
cp /usr/local/apr/include/apr-1/* /usr/local/apache/include/
cp /usr/local/apr-util/include/apr-1/* /usr/local/apache/include/
1
2
3
4
5
|
chown
-R resin.root
/usr/local/resin
service resin start
service httpd start
chkconfig resin on
chkconfig httpd on
|
五、apache与resin整合
1、ls /usr/local/apache/modules #看到已经生成模块mod_caucho.so
2、httpd.conf文件末尾也自动加载了:
3、修改默认resin网站目录为apache根目录
1
2
3
4
|
vi
/usr/local/resin/conf/resin
.xml
<host
id
=
""
root-directory=
"."
>
<web-app
id
=
"/"
root-directory=
"/usr/local/apache/htdocs"
/>
<
/host
>
|
六、测试
在apache根目录创建一个test.jsp索引页来测试能正常访问!整合成功!
现在所有来的访问,如果是html页面,apache来处理,如果是jsp页面则交给resin处理。
本文转自 李振良OK 51CTO博客,原文链接:http://blog.51cto.com/lizhenliang/1303996,如需转载请自行联系原作者