一) 編譯安裝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的端口