apache+tomcat+JDK

#!/bin/sh
cd /root/
tar xzvf httpd-2.2.15.tar.gz && cd httpd-2.2.15
        ./configure --prefix=/usr/local/apache   \
                    --enable-rewrite             \
                    --enable-mods-shared=rewrite
make && make install;
cd /root/install;
cp jdk-6u24-linux-x64.bin /usr/local/;
chmod 777 /usr/local/jdk-6u24-linux-x64.bin ;
cd /usr/local ;
./jdk-6u24-linux-x64.bin ;
mv  -rf  jdk1.6.0_24  /usr/local/ ;
ln -s /usr/local/jdk1.6.0_24  /usr/local/java ;
cd  /root/install/
tar -zxvf tomcat-connectors-1.2.30-src.tar.gz ;
cd tomcat-connectors-1.2.30-src/native/
./configure --with-apxs=/usr/local/apache/bin/apxs
make ; make install
cp ./apache-2.0/mod_jk.so /usr/local/apache/modules/
wget http://labs.mop.com/apache-mirror/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz
tar -zxvf apache-tomcat-6.0.35.tar.gz
mv apache-tomcat-6.0.35 tomcat


cp -f /root/install/httpd.conf /usr/local/apache/conf/
cp /root/install/mod_jk.conf /usr/local/apache/conf/extra/
cp /root/install/workers.properties /usr/local/apache/conf/extra/
cp -rf  /root/install/tomcat   /usr/local/tomcat
cp -rf  /root/install/tomcat2  /usr/local/tomcat2

mod_jk.conf配置内容如下:
more /usr/local/apache/conf/extra/mod_jk.conf
# worker file
JkWorkersFile conf/extra/workers.properties

# Where to put jk logs
JkLogFile logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel error

# Select the log format
#JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicate to send SSL KEY SIZE,
#JkOptions  +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
#JkRequestLogFormat "%w %V %T"

JkMount /*.jsp loadbalancer
JkMount /servlet/* loadbalancer
JkMount /FileServer/* loadbalancer
JkMount /CCS/* loadbalancer
JkMount /PlatServer/* loadbalancer
workers.properties 配置内容如下:
more /usr/local/apache/conf/extra/workers.properties
worker.list=loadbalancer

# -----------------------
# Tomcat host 1
# -----------------------
worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=1

# -----------------------
# Tomcat host 2
# -----------------------
worker.tomcat2.type=ajp13
worker.tomcat2.host=localhost
worker.tomcat2.port=8010
worker.tomcat2.lbfactor=1
# -----------------------
# Tomcat host 3
# -----------------------
worker.tomcat3.type=ajp13
worker.tomcat3.host=localhost
worker.tomcat3.port=8011
worker.tomcat3.lbfactor=1

# -----------------------
# LB settings here
# -----------------------
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcat1,tomcat2,tomcat3

catalina.sh参数优化(最上面加一句):
more /usr/local/tomcat/bin/catalina.sh 
JAVA_OPTS=" -Xms1500m -Xmx1500m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=512m -Djava.awt.headless=true "



只需修改以下配置文件即可。
export JAVA_HOME=/usr/local/jdk1.6.0_24
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME
export PATH=/usr/local/mysql/bin:/usr/local/apache/bin:$JAVA_HOME/bin:$PATH
CLASS_PATH="$JAVA_HOME/lib:$JAVA_HOME/jre/lib"
CLASSPATH="$JAVA_HOME/lib:$JAVA_HOME/jre/lib"     

你可能感兴趣的:(apache)