冰果

技术群:26678700     
交流QQ: 704839634
合作: 1) 可兼职远程办公开发; 2) 有一套Go+Python开发的行业短信云平台可合作;3)目前正在开发物联网、大数据平台。

apache + resin的多机部署方案实现方法

一) 编译安装apache
1) 从apache官网上下载apache最新的 release版本2.2.6
 unix版本取httpd-2.2.6.tar.gz
2) 解开包
 gunzip httpd-2.2.6.tar.gz
 tar xvf httpd-2.2.6.tar
3) 编译安装
 进入解压后的目录httpd-2.2.6,依次执行
 ./configure --prefix=/*要安装apache的目录*/ --enable-so
 make
 make install
 成功后apache就安装到前面指定的目录了

二)  启动apache
 进入apache安装目录
1) 修改apache/conf/httpd.conf
 Listen 80 修改80为需要的端口如 11280
2) 启动
 进入apache/bin/执行: ./apachectl start
3) 打开浏览起访问
 http://ip:11280

三) 编译安装resin-3.0.23
 ./configure --prefix=/home/test/resin --with-apxs=/home/test/apache/bin/apxs  --with-apache=/home/test/apache
 make
 make install

上述操作除了编译安装resin外(其实不做这些操作,resin本身也是可以跑起来的),还会修改apache,包括:
 1. copy mod_caucho.so到apache目录(就是前面指定的--with-apache=/home/test/apache)的modules
 2. 修改apache的配置文件conf/httpd.conf,自动增加以下内容
LoadModule caucho_module /home/test/modules/mod_caucho.so
ResinConfigServer localhost 6802
CauchoConfigCacheDirectory /tmp
CauchoStatus yes

这里准备部署两个resin, 使用cp命令复制一份为resin-b即可.

四)配置resin
需要修改resin.conf文件[两个resin都修改, 内容相同]:

<cluster>
 <srun server-id="a" host="192.168.0.1" port="6802"/>
 <srun server-id="b" host="192.168.0.1" port="6803"/>
</cluster>

五)启动resin
 运行resin/bin/httpd.sh
 注意一定要加-server,否则resin启动后是监听80/8080这样的端口,而不是上面cluster设置里面的6802
 cd /home/test/resin/bin
 ./httpd.sh -server a start
 cd /home/test/resin-b/bin
 ./httpd.sh -server b start
 
 这样resin才会监听6802,建议手工telnet确认一下。如果resin启动不正确,后面apache启动后访问resin就会失败,然后在页面报503错误。
 以后stop/restart 时也需要加-server

六) 配置apache
 确认conf/httpd.conf文件中的以下内容
 1) LoadModule caucho_module ***/modules/mod_caucho.so
  检查mod_caucho.so是否存在
 2) ResinConfigServer localhost 6802
  这个ResinConfigServer只能出现一行,如果resin有多台,请在这里指定的那台resin配置文件中的<cluster>中配置其他机器的ip/port
 3) CauchoConfigCacheDirectory /tmp
 4)CauchoStatus yes

最后修改的配置为:

 LoadModule caucho_module "/home/test/apache/modules/mod_caucho.so"
 ResinConfigServer 192.168.0.1 6802
 ResinConfigServer 192.168.0.1 6803
 AddHandler caucho-request .jsp
 CauchoConfigCacheDirectory /tmp
 CauchoStatus yes

七)web访问
 启动apache
 用浏览器访问apache的端口,注意不是访问resin的端口

posted on 2010-12-19 00:13 冰果 阅读(197) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理