為實現apache+resin的多機部署方案,在SUSE下嘗試了該環境的搭建過程,在此記錄下來,作為安裝說明以便自己及他人查看。
一、編譯安裝apache
   1、從apache官網上下載最新的 release版本,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為需要的端口如 18887
    2、啟動
 進入apache/bin/執行: ./apachectl start
    3、打開瀏覽起訪問
 http://ip: 18887

三、編譯安裝resin

./configure --prefix=/opt/cuix/resin --with-apxs=/opt/cuix/apache/bin/apxs  --with-apache=/opt/cuix/apache
make
make install 

   上述操作除了編譯安裝resin外,還會修改apache的配置,若已存在resin,則可不執行以上的操作,手動進行apache的配置,達到上述操作同等的效果:
    1、copy mod_caucho.so到apache目錄(即--with-apache所指定的目錄)的modules目錄下;
    2、修改apache的配置文件conf/httpd.conf,自動增加以下內容

LoadModule caucho_module ***/modules/mod_caucho.so
ResinConfigServer localhost 
6802
CauchoConfigCacheDirectory 
/tmp
CauchoStatus yes 

 

四、配置resin
   修改resin.conf文件

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

 

五、啟動resin
   運行resin/bin/httpd.sh
   注意一定要加-server,否則resin啟動后是監聽80/8080這樣的端口,而不是上面cluster設置里面的6802,
   ./httpd.sh -server a start
   如果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 "/opt/cuix/apache/modules/mod_caucho.so"
ResinConfigServer 
192.168.0.1 6802
AddHandler caucho
-request .action
CauchoConfigCacheDirectory 
/tmp
CauchoStatus yes


    七、web訪問
    啟動apache。
    用瀏覽器訪問apache的端口,注意不是訪問resin的端口。
    成功完成以上操作后,apache+resin就部署完成了。