Apache 作為前端靜態資源伺服器,Resin 作為後端 Servlet/JSP 容器,通過 mod_caucho 模組整合是經典部署架構。本文記錄從源碼編譯安裝到配置檔修改的完整步驟。
tar xvzf httpd-*.tar.gz
cd httpd-*
./configure --prefix=/usr/local/apache2 --enable-so
make
make install
修改 conf/httpd.conf 進行 HTTP 基礎配置。
tar zxvf resin-*.tar.gz
cd resin-*
./configure --with-apxs=/usr/local/apache2/bin/apxs
make
make install
編譯成功後生成 $APACHE_HOME/modules/mod_caucho.so。
修改 conf/httpd.conf:
LoadModule caucho_module modules/mod_caucho.so
ResinConfigServer localhost 6802
<Location /caucho-status>
SetHandler caucho-status
</Location>
修改 $RESIN_HOME/conf/resin.conf:
<web-app id="/" document-directory="/webapps/ROOT">
<!-- 修改為 Apache DocumentRoot 對應的實體目錄 -->
</web-app>
$RESIN_HOME/bin/httpd.sh start/usr/local/apache2/bin/apachectl starthttps://hostname/caucho-status 查看 Resin 狀態頁,確認整合成功。--enable-so 確保 Apache 支援動態模組載入(Apache 2.x 預設開啟)。--with-apxs 指向 Apache 的 apxs 工具,用於編譯 mod_caucho.so。ResinConfigServer 一致。