您的位置:首页 > 运维架构 > Apache

【Web容器】Linux下Apache+Resin服务器的安装与配置

2015-07-03 17:28 716 查看
说明:以下安装过程基于Centos 5.4 (64位)操作系统。

1、首先安装apache

(1)下载apache,下载地址为:http://mirror.esocc.com/apache//httpd/httpd-2.2.26.tar.gz

(2)tar zxvf httpd-2.2.26.tar.gz

(3)cd httpd-2.2.26

(4)./configure --prefix=/usr/local/httpd --enable-module=so

(5)make && make install

(6)apache安装完成后,进入/usr/local/httpd/bin/目录下,执行./apachecl start命令启动apache

(7)访问http://127.0.0.1/页面查看apache服务是否安装正常。

2、安装Resin

(1)下载resin,下载地址为:http://www.caucho.com/download/resin-4.0.25.tar.gz

(2)tar zxvf resin-4.0.25.tar.gz

(3)cd resin-4.0.25

(4)./configure --prefix=/usr/local/resin --enable-64bit --with-apxs=/usr/local/httpd/bin/apxs (安装resin需指明apache的安装目录)

(5)make && make install

(6)进入apache目录 /usr/local/httpd/conf/目录下,查看httpd.conf文件如果发现以下内容,则表示整合成功。

LoadModule caucho_module /usr/local/httpd/modules/mod_caucho.so

ResinConfigServer localhost 6800

CauchoConfigCacheDirectory /tmp

CauchoStatus yes

3、apache与resin的配置

(1)修改apache配置文件/usr/local/httpd/conf/httpd.conf修改其工程目录:

DocumentRoot "/data/resin"

<Directory
"/data/resin">

Options FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

</Directory>

修改完apache之后,同时修改resin的配置文件/usr/local/resin/conf/resin.xml 将以下部分中的root-directory改为你的工程目录与apache的工程目录相同。

<host id="" root-directory=".">

<web-app id="/" root-directory="/data/resin"/>

<resin:if
test="${resin_doc}">

<web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>

</resin:if>

</host>

4、服务测试

(1)将你的测试工程test放到/data/resin目录下。

(2)进入resin目录/usr/local/resin/bin目录下执行./resinctl restart命令重启resin服务。

(3)访问http://127.0.0.1:8080/test/index.jsp可访问到index.jsp页面,说明resin服务配置正常。

(4)进入apache目录/usr/local/httpd/bin目录下执行./apachectl restart命令重启apache服务。

(5)同样访问http://127.0.0.1/test/index.jsp ,此时的端口号为apache的端口号,发现apache也可以解析jsp文件了,整合成功。

另外:可以通过修改apache的配置文件httpd.conf中的DirectoryIndex,将index.jsp加入进去,则可通过访问http://127.0.0.1/test/ 的方式访问web工程了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: