參考文件:
環境:centos5.8 64bit
安裝apache
這裡我選擇了yum 方式安裝:yum install httpd httpd-devel
解壓並且進入**目錄: tar -xf tomcat-connectors-1.2.37-src.tar.gz && cd tomcat-connectors-1.2.37-src/native/
編譯mod_jk.so模組: ./configure --with-apxs=/usr/sbin/apxs (注意後面跟的引數是關鍵,如果你編譯安裝apxs可能在別的目錄)
make
拷貝模組檔案到apache預設的模組目錄: cp apache-2.0/mod_jk.so /etc/httpd/modules/
在apache配置檔案內引入該模組: vi /etc/httpd/conf/httpd.conf
插入 loadmodule jk_module modules/mod_jk.so
在apache的 conf.d目錄下,新增有關mod_jk的配置: vi /etc/httpd/conf.d/mod_jk.conf
###### 指出mod_jk模組工作所需要的工作檔案workers.properties的位置
新增workers.properties檔案: vi /etc/httpd/conf/workers.properties
worker.list=worker1,worker2,worker3,worker4,worker5,loadbalance1,jkstatus####### set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8031worker.worker1.lbfactor=50worker.worker1.socket_keepalive=1worker.worker1.socket_timeout=300
####### set properties for worker2
worker.worker2.type=ajp13
worker.worker2.host=localhost
worker.worker2.port=8033worker.worker2.lbfactor=50worker.worker2.socket_keepalive=1worker.worker2.socket_timeout=300
####### set properties for worker3
worker.worker3.type=ajp13
worker.worker3.host=localhost
worker.worker3.port=8035worker.worker3.lbfactor=50worker.worker3.socket_keepalive=1worker.worker3.socket_timeout=300
####### set properties for worker4
worker.worker4.type=ajp13
worker.worker4.host=localhost
worker.worker4.port=8037worker.worker4.lbfactor=50worker.worker4.socket_keepalive=1worker.worker4.socket_timeout=300
####### set properties for worker5
worker.worker5.type=ajp13
worker.worker5.host=localhost
worker.worker5.port=8039worker.worker5.lbfactor=50worker.worker5.socket_keepalive=1worker.worker5.socket_timeout=300
##set loadbalance 1 這裡是負載均衡部分,使用了session sticky功能
worker.loadbalance1.type=lb
worker.loadbalance1.balance_workers=worker1,worker2,worker3,worker4,worker5
worker.loadbalance1.sticky_session=true
#define a 'jkstatus' worker using status
worker.jkstatus.type=status
在apache主配置檔案內編輯virtualhost
serveradmin [email protected]documentroot /www/docs/www.testserver.com
servername www.testserver.com
errorlog logs/www.testserver.com-error_log
customlog logs/www.testserver.com-access_log common
/*>jkmount loadbalance1
/jkmanager/>jkmount jkstatus
order deny,allow
deny from all
allow from 192.168.1.1
重啟apache: /etc/init.d/httpd restart
注:引用本文,請註明來自:
附錄:ubuntu12.04 環境下
安裝apache: apt-get install apache2
安裝devel包: apt-get install apache2-dev
apxs現在叫做 apxs2
apache tomcat整合 我的心得
最近頭說要用apache跳轉resin和tomcat兩個伺服器,很有挑戰.於是開始研究.在之前的apache與resin的整合已經成功了,現在的主要任務是在resin繼續被apache跳轉的情況下整合apache和tomcat 一.進入正題 提前要說明幾點請大家注意 1.我用mod jk來整合apa...
Apache Tomcat 負載均衡整合
第一次整合apache tomcat,在網路上差了很多資料,然後按著資料配置 環境說明 兩台window2003伺服器 在apache的httpd.conf檔案最後面加上include conf mod jk.conf 在httpd.conf同目錄下新建mod jk.conf檔案,內容如下 在htt...
請教整合apache tomcat 問題
我在本機xp系統整合沒有任何問題 httpd.conf增加 loadmodule jk2 module modules mod jk2.so serveradmin webmaster dummy host.example.com servername dummy host.example.com ...