8080 8980
8005 8905
8009 8909
4000 4001
1.安装httpd
tar zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/apache2 --enable-so
make && make install
2.安装JDK
chmod +x jdk-6u18-linux-i586.bin
./jdk-6u18-linux-i586.bin
mv jdk1.6.0_18 /usr/local/jdk
rm -rf /usr/bin/java
rm -rf /usr/bin/javac
ln -s /usr/local/jdk/bin/java /usr/bin/java
ln -s /usr/local/jdk/bin/javac /usr/bin/javac
[root@CentOSlamp src]# java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
ln -s /usr/local/jdk/jre /usr/local/jre
设置环境变量
vi /etc/profile 添加如下内容
JAVA_HOME=/usr/local/jdk
export JAVA_HOME
JRE_HOME=/usr/local/jre
export JRE_HOME
运行,使环境变量生效
source /etc/profile
3.安装tomcat
tar zxvf apache-tomcat-7.0.6.tar.gz
mv apache-tomcat-7.0.6 /usr/local/tomcat1
tar zxvf apache-tomcat-7.0.6.tar.gz
mv apache-tomcat-7.0.6 /usr/local/tomcat2
4.安装tomcat-connectors
tar zxvf tomcat-connectors-1.2.31-src.tar.gz
cd tomcat-connectors-1.2.31-src/native/
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-java-home=/usr/local/jdk
make && make install
5. 配置httpd.conf 文件
vi /usr/local/apache2/conf/httpd.conf
添加
LoadModule jk_module modules/mod_jk.so
<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkLogLevel warn
</IfModule>
6.创建并配置workers.properties文件
vi /usr/local/apache2/conf/workers.properties
worker.list=wlb , jkstatus
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
# Define preferred failover node for worker1
#worker.worker1.redirect=worker2
worker.worker2.port=8909
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
# Disable worker2 for all requests except failover
#worker.worker2.activation=disabled
worker.wlb.type=lb
worker.wlb.balance_workers=worker1,worker2
worker.jkstatus.type=status
以上注释掉的两行如果开启,则worker2成为worker1的备用,在worker1不可用的情况下才会向worker2请求