- 論壇徽章:
- 0
|
首先安裝Apache2.2:
由于安裝apache2.2需要先安裝arp和arp-util這兩個東東所以也要從
www.apache.org/dist
上下載.
安裝apr
# cd srclib/apr
# ./configure --prefix=/usr/local/apr
# make
# make install
安裝apr-util
# cd ../apr-util/
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make install
安裝 apache(編譯時加入ajp代理以及反向代理參數(shù)以及負(fù)載均衡參數(shù))
#./configure --prefix=/usr/apache2.2 --enable-proxy --enable-proxy-ajp --enable-proxy-balancer --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
#make
#make install
啟動apache:
#/usr/apache2.2/bin/apachectl –k start
負(fù)載均衡配置
apache安裝成功以后需要對它的兩個配置文件conf/httpd.conf和conf/extra/httpd-vhosts.conf做一點小小的修改。
在conf/httpd.conf文件里搜索一下“Include conf/extra/httpd-vhosts.conf”,把前面的“#”去掉。然后“conf/extra/httpd-vhosts.conf”文件修改如下:
ServerName localhost #服務(wù)器名稱
CustomLog logs/dmim_log combined #日志
#負(fù)載均衡配置,可列出多個Tomcat;以下為連接Tomcat AJP監(jiān)聽器,
BalancerMember ajp://134.140.55.236:8009
BalancerMember ajp://134.140.55.236:9009
BalancerMember ajp://134.140.55.239:8009
#代理配置
ProxyPass balancer://localhost/
#ProxyPassReverse balancer://localhost/
集群配置:
Tomcat5.5自帶集群功能,只要把server.xml中的“Cluster”元素注釋掉就行了,并且在每個web應(yīng)用項目的web.xml文件,添加元素。然后把tomcat復(fù)制幾份到不同機器就行了(根據(jù)Tomcat官方文檔描述一般配置2~4個作為集群,tomcat的配置要跟apache的負(fù)載均衡配置相對應(yīng));如果集群放在同一臺機器上,要注意修改各個server.xml的以下元素: (紅色的表示每個服務(wù)器配置的端口都不能一樣,以免端口被占用)
最后重啟apache和各個tomcat就行了
本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/31839/showart_2096516.html |
|