<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3"]]></title>
		<link>https://forum.andowson.com/posts/list/20.page</link>
		<description><![CDATA[Latest messages posted in the topic "Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ An Auto Installer for Integrating Apache 2.2 and Tomcat 6.0 for Clustering/Session Replication, Load Balancing with mod_jk 1.2 on CentOS 5.3 
<br>
Author: Andowson Chang 
<br>
Date: 2009.04.25 
<br>
Modified: 2009.07.05 (Update the JDK new version's download URL) 
<br>
 2009.12.23 (Update Tomcat process stop status check method) 
<br>
 2010.01.04 (Update Tomcat's version information URL) 
<br>
 2010.04.14 (Update TOMCAT_VERSION and TOMCAT_CONNECTOR_VERSION and LOG4J_VERSION, remove install JDK section from the shell script) 
<br>
 2010.04.15 (Update Log4J version determination and use useradd -M for not create home directory for user tomcat) 
<br>
 2010.05.01 Add apr-devel for x86_64 support 
<br>
<br>
Design: 
<br>
1. One Apache and Two Tomcat workers on the same machine. 
<br>
2. Use mod_jk for load balancer 
<br>
3. Use mod_ssl for SSL 
<br>
4. Enable cluster configuration on both Tomcat workers to do session replication 
<br>
[img]http://andowson.myweb.hinet.net/img/apache_tomcat_integration.jpg[/img] 
<br>
<br>
Steps: 
<br>
1.Install CentOS 5.3 ([color=red]disbale SELinux and Firewall[/color]) 
<br>
2.Install JDK 
<br>
3.Install Apache and mod_ssl 
<br>
4.Generate SSL key and certificate 
<br>
5.Edit httpd.conf 
<br>
6.Edit ssl.conf 
<br>
7.Install Tomcat, mod_jk 
<br>
8.Edit server.xml 
<br>
9.Edit mod_jk.conf 
<br>
10.Edit workers.properties 
<br>
11.Edit uriworkermap.properties 
<br>
12.Start Apache and Tomcat 
<br>
<br>
Testing: 
<br>
1.Browsing http://&lt;your_server_ip&gt;/clustertest.jsp, add some keys and values. 
<br>
2.Shutdown worker1 
<br>
3.Browsing http://&lt;your_server_ip&gt;/clustertest.jsp, check if the keys and values are still there. 
<br>
4.Run restart.sh 
<br>
5.Browsing http://&lt;your_server_ip&gt;/clustertest.jsp, check if the keys and values are still there. 
<br>
6.Browsing https://&lt;your_server_ip&gt;/clustertest.jsp, check if the keys and values are still there. 
<br>
<br>
Implementation: 
<br>
1.See http://www.howtoforge.com/perfect-server-centos-5.3-x86_64-ispconfig-2 for step1. 
<br>
2.Install JDK(check [url]http://java.sun.com[/url] for latest version) 
<br>
[code] 
<br>
# 
<br>
# install JDK 6.0 Update 20 
<br>
# 
<br>
if [ ! -r jdk-6u20-linux-i586-rpm.bin ]; then 
<br>
 wget "http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u20-linux-i586-rpm.bin?BundledLineItemUUID=PBGJ_hCwt5wAAAEopeNsZ47R&amp;OrderID=_1CJ_hCwkZcAAAEoleNsZ47R&amp;ProductID=guBIBe.oc_wAAAEnaDJHqPYe&amp;FileName=/jdk-6u20-linux-i586-rpm.bin" -O jdk-6u20-linux-i586-rpm.bin 
<br>
fi 
<br>
echo 'yes'|sh jdk-6u20-linux-i586-rpm.bin[/code] 
<br>
3.Create a directory /root/setup and download the auto installer script for step 3-11, save it as httpd2_tomcat6-setup.sh in /root/setup 
<br>
mkdir -p /root/setup 
<br>
then run it 
<br>
chmod 755 /root/setup/httpd2_tomcat6-setup.sh 
<br>
cd /root/setup 
<br>
./httpd2_tomcat6-setup.sh 
<br>
<br>
[b]httpd2_tomca6-setup.sh[/b]: 
<br>
[code] 
<br>
#!/bin/bash 
<br>
# Name: Apache 2.2.x &amp;&amp; Tomcat 6.0.x auto installer 
<br>
# Author: Andowson Chang (andowson [at] gmail [dot] com) 
<br>
# Version: 5.10 
<br>
# Last Modified: 2010-05-01 
<br>
# Source: http://www.andowson.com 
<br>
# Assumption: JDK must be installed on /usr/java 
<br>
# This program will 
<br>
# 1.install httpd and mod_ssl 
<br>
# 2.modify /etc/http/conf/httpd.conf 
<br>
# 3.generate SSL key and a self-signed certificate 
<br>
# 4.modify /etc/http/conf.d/ssl.conf 
<br>
# 5.check for the lastest stable version of Tomcat 6.0.x 
<br>
# 6.download apache-tomcat-6.0.x.tar.gz 
<br>
# 7.unpack it into /var/apache-tomcat-6.0.x 
<br>
# 8.make a symbolic link /var/tomcat6 to the above directory for easy upgrade 
<br>
# to a later version 
<br>
# 9.check memory size to determine some JVM parameters 
<br>
# 10.check for the latest stable verion of Tomcat Connector 1.2.x 
<br>
# 11.download tomcat-connectors-1.2.x-src.tar.gz 
<br>
# 12.unpack it 
<br>
# 13.configure, make and make install 
<br>
# 14.create user tomcat with home directory /var/tomcat6 
<br>
# 15.make two instances of tomcat for load balancing, here I put them under 
<br>
# /var/robust/worker[1,2] for easy to backup all of them. 
<br>
# 16.setup default host directory(for testing) 
<br>
# 17.generate server.xml 
<br>
# 18.generate tomcat-users.xml 
<br>
# 19.modify web.xml for production use 
<br>
# 20.generate mod_jk.conf 
<br>
# 21.generate workers.properties 
<br>
# 22.generate uriworkermap.properties 
<br>
# 23.generate tomcat startup script 
<br>
# 24.modify web.xml for cluster test 
<br>
# 25.generate clustertest.jsp for cluster test 
<br>
# 26.generate cleanup.sh for easy to uninstall everything 
<br>
<br>
# 
<br>
# intranet workaround 
<br>
# If your server don't have Internet access, ie. in the intranet behind 
<br>
# a firewall, you have to download all the files manually first. Copy them 
<br>
# into ${SETUP_DIR}. And then change the following default version 
<br>
# number to the correct number you have downloaded. 
<br>
# 
<br>
TOMCAT_VERSION=6.0.26 
<br>
TOMCAT_CONNECTOR_VERSION=1.2.30 
<br>
LOG4J_VERSION=1.2.16 
<br>
<br>
# 
<br>
# auto detect ip and hostname 
<br>
# 
<br>
ip=`/sbin/ifconfig|grep "inet addr"|awk '{print $2}'|cut -d":" -f2|head -1` 
<br>
hostname=`/bin/hostname -f` 
<br>
<br>
# 
<br>
# adjustable parameters, you can modify any of them to fit your own need 
<br>
# 
<br>
DOMAIN=`/bin/hostname -d` 
<br>
COUNTRY=TW 
<br>
STATE=Taiwan 
<br>
LOCATION=Taipei 
<br>
COMPANY="Andowson Ltd." 
<br>
ORGANIZATION= 
<br>
HOSTNAME=${hostname} 
<br>
hostname=${ip} 
<br>
MIRROR_HOST=apache.ntu.edu.tw 
<br>
CATALINA_HOME=/var/tomcat6 
<br>
WORKER_ROOT=/var/robust 
<br>
WEBAPP_ROOT=/var/webapps 
<br>
SETUP_DIR=/root/setup/web 
<br>
mkdir -p ${SETUP_DIR} 
<br>
cd ${SETUP_DIR} 
<br>
echo 'service tomcat stop' &gt; ${SETUP_DIR}/cleanup.sh 
<br>
echo 'service httpd stop' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# install httpd and mod_ssl 
<br>
# 
<br>
yum -y install httpd mod_ssl 
<br>
cp -rf /etc/httpd/conf/httpd.conf /tmp/httpd.conf 
<br>
cp -rf /etc/httpd/conf.d/ssl.conf /tmp/ssl.conf 
<br>
<br>
# 
<br>
# modify httpd.conf 
<br>
# 
<br>
sed -i -e "44c\ServerTokens ProductOnly" \ 
<br>
-e "74c\KeepAlive On" \ 
<br>
-e "232c\Group tomcat" \ 
<br>
-e "251c\ServerAdmin webmaster@${DOMAIN}" \ 
<br>
-e "265a\ServerName 127.0.0.1:80" \ 
<br>
-e "281a\VirtualDocumentRoot /var/webapps/%0" \ 
<br>
-e "391c\DirectoryIndex sorry.html index.html index.htm default.html default.htm index.html.var index.jsp" \ 
<br>
-e '488a\LogFormat "%V %h %l %u %t \\"%r\\" %&gt;s %b" vcommon' \ 
<br>
-e '488a\LogFormat "%V %h %l %u %t \\"%r\\" %&gt;s %b \\"%{Referer}i\\" \\"%{User-Agent}i\\"" vcombined' \ 
<br>
-e '492c\LogFormat "%h %l %u %t \\"%r\\" %&gt;s %b \\"%{Referer}i\\" \\"%{User-Agent}i\\" %I %O" combinedio' \ 
<br>
-e "514c\CustomLog logs/access_log combinedio\nCustomLog logs/vhost.log vcombined" \ 
<br>
-e "524c\ServerSignature Off" \ 
<br>
-e "731c\LanguagePriority zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN" \ 
<br>
-e "954a\&lt;Location /&gt;" \ 
<br>
-e "954a\ # Insert filter" \ 
<br>
-e "954a\ SetOutputFilter DEFLATE\n" \ 
<br>
-e "954a\ # Netscape 4.x has some problems..." \ 
<br>
-e "954a\ BrowserMatch ^Mozilla/4 gzip-only-text/html\n" \ 
<br>
-e "954a\ # Netscape 4.06-4.08 have some more problems" \ 
<br>
-e '954a\ BrowserMatch ^Mozilla/4\\.0[678] no-gzip\n' \ 
<br>
-e "954a\ # MSIE masquerades as Netscape, but it is fine" \ 
<br>
-e '954a\ # BrowserMatch \\bMSIE \!no-gzip \!gzip-only-text/html\n' \ 
<br>
-e "954a\ # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48" \ 
<br>
-e "954a\ # the above regex won't work. You can use the following" \ 
<br>
-e "954a\ # workaround to get the desired effect:" \ 
<br>
-e '954a\ BrowserMatch \\bMSI[E] \!no-gzip \!gzip-only-text/html\n' \ 
<br>
-e "954a\ # Don't compress images" \ 
<br>
-e '954a\ SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)$ no-gzip dont-vary\n' \ 
<br>
-e "954a\ # Make sure proxies don't deliver the wrong content" \ 
<br>
-e "954a\ Header append Vary User-Agent env=\!dont-vary" \ 
<br>
-e "954a\&lt;/Location&gt;\n" \ 
<br>
-e "954a\RewriteEngine on" \ 
<br>
-e "954a\RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)" \ 
<br>
-e "954a\RewriteRule .* - [F]\n" /etc/httpd/conf/httpd.conf 
<br>
echo 'cp -rf /tmp/httpd.conf /etc/httpd/conf/httpd.conf' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# generate SSL key and cert 
<br>
# 
<br>
openssl genrsa -out /etc/pki/tls/private/${HOSTNAME}.key 2048 
<br>
openssl req -new -key /etc/pki/tls/private/${HOSTNAME}.key -out /etc/pki/tls/certs/${HOSTNAME}.csr -subj "/C=${COUNTRY}/ST=${STATE}/L=${LOCATION}/O=${COMPANY}/OU=${ORGANIZATION}/CN=${HOSTNAME}" 
<br>
openssl x509 -req -days 3650 -in /etc/pki/tls/certs/${HOSTNAME}.csr -signkey /etc/pki/tls/private/${HOSTNAME}.key -out /etc/pki/tls/certs/${HOSTNAME}.crt 
<br>
echo 'rm -rf /etc/pki/tls/private/'${HOSTNAME}'.key' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
echo 'rm -rf /etc/pki/tls/certs/'${HOSTNAME}'.csr' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
echo 'rm -rf /etc/pki/tls/certs/'${HOSTNAME}'.crt' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# modify ssl.conf 
<br>
# 
<br>
sed -i -e "86a\JkMountFile conf/uriworkermap.properties\n" \ 
<br>
-e "112c\SSLCertificateFile /etc/pki/tls/certs/${HOSTNAME}.crt" \ 
<br>
-e "119c\SSLCertificateKeyFile /etc/pki/tls/private/${HOSTNAME}.key" /etc/httpd/conf.d/ssl.conf 
<br>
echo 'cp -rf /tmp/ssl.conf /etc/httpd/conf.d/ssl.conf' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
chkconfig --level 235 httpd on 
<br>
echo 'chkconfig httpd off' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# check the latest stable version of Tomcat 6.0.x 
<br>
# 
<br>
wget http://tomcat.apache.org/whichversion.html -q -t 1 -T 5 -O /tmp/tomcat.html 
<br>
if [ -s /tmp/tomcat.html ]; then 
<br>
 TOMCAT_VERSION=`grep "6\.0\." /tmp/tomcat.html|grep -v "6\.0\.x"|cut -d"&gt;" -f2|cut -d"&lt;" -f1` 
<br>
fi 
<br>
rm -rf /tmp/tomcat.html 
<br>
<br>
echo "Install Tomcat ${TOMCAT_VERSION}" 
<br>
if [ ! -r apache-tomcat-${TOMCAT_VERSION}.tar.gz ]; then 
<br>
 wget http://${MIRROR_HOST}/tomcat/tomcat-6/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz 
<br>
fi 
<br>
tar zxvf apache-tomcat-${TOMCAT_VERSION}.tar.gz -C /var 
<br>
ln -s /var/apache-tomcat-${TOMCAT_VERSION} ${CATALINA_HOME} 
<br>
<br>
echo 'rm -rf /var/apache-tomcat-'${TOMCAT_VERSION} &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
echo 'rm -rf '${CATALINA_HOME} &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# check memory size to determine some JVM parameters 
<br>
# 
<br>
mem=`cat /proc/meminfo|grep "MemTotal:"|awk '{print $2}'` 
<br>
let KB=1024 
<br>
let memsize=$mem/$KB 
<br>
let heapsize=$memsize/2 
<br>
let newsize=$heapsize/4 
<br>
echo 'JAVA_HOME="/usr/java/latest" 
<br>
JAVA_OPTS="-server -XX:NewSize='${newsize}'m -XX:MaxNewSize='${newsize}'m -XX:SurvivorRatio=8 -XX:MaxPermSize=128m -Xss256k -Xms'${heapsize}'m -Xmx'${heapsize}'m -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true"' &gt; ${CATALINA_HOME}/bin/setenv.sh 
<br>
chmod 755 ${CATALINA_HOME}/bin/setenv.sh 
<br>
<br>
# 
<br>
# check the latest stable version of Tomcat Connector 1.2.x 
<br>
# 
<br>
# pre-requirment 
<br>
yum -y install httpd-devel apr-devel libtool automake make gcc gcc-c++ 
<br>
<br>
wget http://tomcat.apache.org/download-connectors.cgi -q -t 1 -T 5 -O /tmp/connector.html 
<br>
if [ -s /tmp/connector.html ]; then 
<br>
 TOMCAT_CONNECTOR_VERSION=`grep "1\.2\." /tmp/connector.html|cut -d"&gt;" -f2|cut -d"&lt;" -f1 |awk '{print $2}'|grep "1.2"|uniq` 
<br>
fi 
<br>
rm -rf /tmp/connector.html 
<br>
echo "Install Tomcat Connector JK ${TOMCAT_CONNECTOR_VERSION}" 
<br>
if [ ! -r tomcat-connectors-${TOMCAT_CONNECTOR_VERSION}-src.tar.gz ]; then 
<br>
 wget http://${MIRROR_HOST}/tomcat/tomcat-connectors/jk/source/jk-${TOMCAT_CONNECTOR_VERSION}/tomcat-connectors-${TOMCAT_CONNECTOR_VERSION}-src.tar.gz 
<br>
fi 
<br>
tar zxvf tomcat-connectors-${TOMCAT_CONNECTOR_VERSION}-src.tar.gz 
<br>
cd tomcat-connectors-${TOMCAT_CONNECTOR_VERSION}-src/native 
<br>
./buildconf.sh 
<br>
./configure --with-apxs=/usr/sbin/apxs 
<br>
make 
<br>
make install 
<br>
cd ${SETUP_DIR} 
<br>
echo 'rm -rf /etc/httpd/modules/mod_jk.so' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# check the latest stable version of Log4J 
<br>
# 
<br>
wget http://logging.apache.org/log4j/1.2/download.html -q -t 1 -T 5 -O /tmp/log4j.html 
<br>
if [ -s /tmp/log4j.html ]; then 
<br>
 LOG4J_VERSION=`grep "1\.2\." /tmp/log4j.html|cut -d"&lt;" -f3|cut -d"&gt;" -f2|awk '{print $4}'|head -1` 
<br>
fi 
<br>
rm -rf /tmp/log4j.html 
<br>
echo "Install Log4J ${LOG4J_VERSION}" 
<br>
if [ ! -r apache-log4j-${LOG4J_VERSION}.tar.gz ]; then 
<br>
 wget http://${MIRROR_HOST}/logging/log4j/${LOG4J_VERSION}/apache-log4j-${LOG4J_VERSION}.tar.gz 
<br>
fi 
<br>
tar zxvf apache-log4j-${LOG4J_VERSION}.tar.gz 
<br>
cp -rf ${SETUP_DIR}/apache-log4j-${LOG4J_VERSION}/log4j-${LOG4J_VERSION}.jar ${CATALINA_HOME}/lib 
<br>
<br>
# 
<br>
# replace tomcat-juli.jar and add tomcat-juli-adapters.jar for log4j 
<br>
# 
<br>
if [ ! -r tomcat-juli.jar ]; then 
<br>
 wget http://${MIRROR_HOST}/tomcat/tomcat-6/v${TOMCAT_VERSION}/bin/extras/tomcat-juli.jar 
<br>
fi 
<br>
cp -rf tomcat-juli.jar ${CATALINA_HOME}/bin 
<br>
if [ ! -r tomcat-juli-adapters.jar ]; then 
<br>
 wget http://${MIRROR_HOST}/tomcat/tomcat-6/v${TOMCAT_VERSION}/bin/extras/tomcat-juli-adapters.jar 
<br>
fi 
<br>
cp -rf tomcat-juli-adapters.jar ${CATALINA_HOME}/lib 
<br>
<br>
# 
<br>
# generate log4j.properties 
<br>
# 
<br>
echo 'log4j.rootLogger=INFO, R 
<br>
log4j.appender.R=org.apache.log4j.RollingFileAppender 
<br>
log4j.appender.R.File=logs/tomcat.log 
<br>
log4j.appender.R.MaxFileSize=10MB 
<br>
log4j.appender.R.MaxBackupIndex=10 
<br>
log4j.appender.R.layout=org.apache.log4j.PatternLayout 
<br>
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n 
<br>
log4j.logger.org.apache.catalina=INFO, R' &gt; ${CATALINA_HOME}/lib/log4j.properties 
<br>
<br>
# 
<br>
# add user tomcat 
<br>
# 
<br>
groupadd -g 80 tomcat 
<br>
useradd tomcat -u 80 -g tomcat -d ${CATALINA_HOME} 
<br>
echo 'userdel -r tomcat' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
echo 'groupdel tomcat' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# setup workers' directory 
<br>
# 
<br>
mkdir -p ${WORKER_ROOT}/logs 
<br>
mkdir -p ${WORKER_ROOT}/worker1/logs 
<br>
mkdir -p ${WORKER_ROOT}/worker1/temp 
<br>
mkdir -p ${WORKER_ROOT}/worker1/work 
<br>
cp -rf ${CATALINA_HOME}/conf ${WORKER_ROOT}/worker1/conf 
<br>
mkdir -p ${WEBAPP_ROOT} 
<br>
ln -s ${WEBAPP_ROOT} ${WORKER_ROOT}/worker1/webapps 
<br>
cp -rf ${WORKER_ROOT}/worker1 ${WORKER_ROOT}/worker2 
<br>
echo 'rm -rf '${WEBAPP_ROOT} &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# setup default host directory 
<br>
# 
<br>
mkdir -p ${WEBAPP_ROOT}/${hostname} 
<br>
cp -rf ${CATALINA_HOME}/webapps/ROOT/* ${WEBAPP_ROOT}/${hostname}/. 
<br>
mkdir -p ${WORKER_ROOT}/worker1/conf/Catalina/${hostname} 
<br>
mkdir -p ${WORKER_ROOT}/worker2/conf/Catalina/${hostname} 
<br>
cp -rf ${CATALINA_HOME}/webapps/host-manager/manager.xml ${WORKER_ROOT}/worker1/conf/Catalina/${hostname} 
<br>
cp -rf ${CATALINA_HOME}/webapps/host-manager/manager.xml ${WORKER_ROOT}/worker2/conf/Catalina/${hostname} 
<br>
<br>
# 
<br>
# generate server.xml 
<br>
# 
<br>
echo '&lt;?xml version="1.0" encoding="utf-8"?&gt; 
<br>
&lt;Server port="workerPort" shutdown="shutdownCode"&gt; 
<br>
<br>
 &lt;GlobalNamingResources&gt; 
<br>
 &lt;!-- Used by Manager webapp --&gt; 
<br>
 &lt;Resource name="UserDatabase" auth="Container" 
<br>
 type="org.apache.catalina.UserDatabase" 
<br>
 description="User database that can be updated and saved" 
<br>
 factory="org.apache.catalina.users.MemoryUserDatabaseFactory" 
<br>
 pathname="conf/tomcat-users.xml" /&gt; 
<br>
 &lt;/GlobalNamingResources&gt; 
<br>
<br>
 &lt;Service name="Catalina"&gt; 
<br>
 &lt;!-- Define an AJP 1.3 Connector on port ajpPort --&gt; 
<br>
 &lt;Connector port="ajpPort" address="127.0.0.1" 
<br>
 enableLookups="false" maxThreads="1000" connectionTimeout="3000" 
<br>
 protocol="AJP/1.3" /&gt; 
<br>
<br>
 &lt;Engine name="Catalina" defaultHost="mydomain" jvmRoute="workerNo"&gt; 
<br>
<br>
 &lt;Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/&gt; 
<br>
<br>
 &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm" 
<br>
 resourceName="UserDatabase" /&gt; 
<br>
' &gt; /tmp/server.header.template 
<br>
<br>
sed -e "s/workerPort/8105/g" -e "s/shutdownCode/`head -1024c /dev/urandom | md5sum | cut -d " " -f1`/g" -e "s/ajpPort/8109/g" -e "s/workerNo/worker1/g" -e "s/mydomain/${hostname}/g" /tmp/server.header.template &gt; ${WORKER_ROOT}/worker1/conf/server.header 
<br>
sed -e "s/workerPort/8205/g" -e "s/shutdownCode/`head -1024c /dev/urandom | md5sum | cut -d " " -f1`/g" -e "s/ajpPort/8209/g" -e "s/workerNo/worker2/g" -e "s/mydomain/${hostname}/g" /tmp/server.header.template &gt; ${WORKER_ROOT}/worker2/conf/server.header 
<br>
rm -rf /tmp/server.header.template 
<br>
<br>
echo ' &lt;Host name="'${hostname}'" appBase="webapps/'${hostname}'" 
<br>
 unpackWARs="true" autoDeploy="true"&gt; 
<br>
 &lt;Valve className="org.apache.catalina.valves.AccessLogValve" 
<br>
 directory="logs" prefix="'${hostname}'_access_log." suffix=".txt" 
<br>
 pattern="combined" resolveHosts="false"/&gt; 
<br>
 &lt;Context path="" docBase="" reloadable="false" /&gt; 
<br>
 &lt;/Host&gt;' &gt; ${WORKER_ROOT}/worker1/conf/server.host 
<br>
<br>
cp -rf ${WORKER_ROOT}/worker1/conf/server.host ${WORKER_ROOT}/worker2/conf/server.host 
<br>
<br>
echo ' &lt;/Engine&gt; 
<br>
 &lt;/Service&gt; 
<br>
&lt;/Server&gt;' &gt; ${WORKER_ROOT}/worker1/conf/server.footer 
<br>
<br>
cp -rf ${WORKER_ROOT}/worker1/conf/server.footer ${WORKER_ROOT}/worker2/conf/server.footer 
<br>
<br>
cd ${WORKER_ROOT}/worker1/conf 
<br>
cat server.header server.host server.footer &gt; server.xml 
<br>
cd ${WORKER_ROOT}/worker2/conf 
<br>
cat server.header server.host server.footer &gt; server.xml 
<br>
<br>
# 
<br>
# generate tomcat-users.xml 
<br>
# 
<br>
MANAGER_PASSWORD=`head -1024c /dev/urandom | md5sum | cut -d " " -f1 | awk '{print substr($1,1,8)}'` 
<br>
echo '&lt;tomcat-users&gt; 
<br>
 &lt;user username="manager" password="'${MANAGER_PASSWORD}'" roles="manager"/&gt; 
<br>
&lt;/tomcat-users&gt;' &gt; ${WORKER_ROOT}/worker1/conf/tomcat-users.xml 
<br>
echo 
<br>
echo "Your Tomcat Manager's login is 'manager', password is '${MANAGER_PASSWORD}'" 
<br>
echo 
<br>
cp -rf ${WORKER_ROOT}/worker1/conf/tomcat-users.xml ${WORKER_ROOT}/worker2/conf/tomcat-users.xml 
<br>
<br>
# 
<br>
# modify web.xml for production use 
<br>
# 
<br>
sed -i -e "97a\ &lt;init-param&gt;\n &lt;param-name&gt;readonly&lt;/param-name&gt;\n &lt;param-value&gt;true&lt;/param-value&gt;\n &lt;/init-param&gt;" \ 
<br>
-e "246a\ &lt;init-param&gt;\n &lt;param-name&gt;genStringAsCharArray&lt;/param-name&gt;\n &lt;param-value&gt;true&lt;/param-value&gt;\n &lt;/init-param&gt;" \ 
<br>
-e "246a\ &lt;init-param&gt;\n &lt;param-name&gt;trimSpaces&lt;/param-name&gt;\n &lt;param-value&gt;true&lt;/param-value&gt;\n &lt;/init-param&gt;" ${WORKER_ROOT}/worker1/conf/web.xml 
<br>
cp -rf ${WORKER_ROOT}/worker1/conf/web.xml ${WORKER_ROOT}/worker2/conf/web.xml 
<br>
<br>
chmod 600 ${WORKER_ROOT}/worker*/conf/server.* 
<br>
chmod 600 ${WORKER_ROOT}/worker*/conf/tomcat-users.xml 
<br>
chown -R tomcat:tomcat /var/apache-tomcat-* 
<br>
chown -R tomcat:tomcat ${WORKER_ROOT} 
<br>
<br>
# 
<br>
# generate mod_jk.conf 
<br>
# 
<br>
echo 'LoadModule jk_module modules/mod_jk.so 
<br>
<br>
JkWorkersFile /etc/httpd/conf/workers.properties 
<br>
JkShmFile logs/jk-runtime-status 
<br>
JkLogFile "|/usr/sbin/rotatelogs /var/log/httpd/mod_jk.log 86400" 
<br>
JkLogLevel info 
<br>
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" 
<br>
JkRequestLogFormat "%w %V %T" 
<br>
LogFormat "%h %l %u %t \"%r\" %&gt;s %b %{JK_WORKER_NAME}n %{JK_LB_FIRST_NAME}n %{JK_LB_FIRST_BUSY}n %{JK_LB_LAST_NAME}n %{JK_LB_LAST_BUSY}n" mod_jk_log 
<br>
CustomLog logs/worker_access_log mod_jk_log 
<br>
<br>
# Load mount points 
<br>
JkMountFile conf/uriworkermap.properties 
<br>
<br>
# Deny direct access to WEB-INF 
<br>
&lt;LocationMatch ".*WEB-INF.*"&gt; 
<br>
 deny from all 
<br>
&lt;/LocationMatch&gt;' &gt; /etc/httpd/conf.d/mod_jk.conf 
<br>
echo 'rm -rf /etc/httpd/conf.d/mod_jk.conf' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# generate workers.properties 
<br>
# 
<br>
echo '# workers.properties - ajp13 
<br>
# 
<br>
# List workers 
<br>
# 
<br>
worker.list=loadbalancer, jkstatus 
<br>
<br>
# 
<br>
# Define worker1 
<br>
# 
<br>
worker.worker1.type=ajp13 
<br>
worker.worker1.host=localhost 
<br>
worker.worker1.port=8109 
<br>
worker.worker1.socket_timeout=1200 
<br>
worker.worker1.connection_pool_size=1 
<br>
worker.worker1.connection_pool_timeout=1300 
<br>
worker.worker1.lbfactor=1 
<br>
# Define prefered failover node for worker1 
<br>
worker.worker1.redirect=worker2 
<br>
<br>
# 
<br>
# Define worker2 
<br>
# 
<br>
worker.worker2.type=ajp13 
<br>
worker.worker2.host=localhost 
<br>
worker.worker2.port=8209 
<br>
worker.worker2.socket_timeout=1200 
<br>
worker.worker2.connection_pool_size=1 
<br>
worker.worker2.connection_pool_timeout=1300 
<br>
worker.worker2.lbfactor=1 
<br>
# Disable worker2 for all requests except failover 
<br>
worker.worker2.activation=d 
<br>
<br>
# 
<br>
# Defining a load balancer 
<br>
# 
<br>
worker.loadbalancer.type=lb 
<br>
worker.loadbalancer.balance_workers=worker1, worker2 
<br>
<br>
# 
<br>
# Define status worker 
<br>
# 
<br>
worker.jkstatus.type=status' &gt; /etc/httpd/conf/workers.properties 
<br>
echo 'rm -rf /etc/httpd/conf/workers.properties' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# generate uriworkermap.properties 
<br>
# 
<br>
echo '/jkmanager/*=jkstatus 
<br>
/*.jsp=loadbalancer 
<br>
/*.do=loadbalancer 
<br>
/*.page=loadbalancer 
<br>
/dwr/*=loadbalancer 
<br>
/servlet/*=loadbalancer 
<br>
/manager/*=loadbalancer' &gt; /etc/httpd/conf/uriworkermap.properties 
<br>
echo 'rm -rf /etc/httpd/conf/uriworkermap.properties' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
# 
<br>
# generate tomcat startup script 
<br>
# 
<br>
echo '#!/bin/sh 
<br>
# 
<br>
# Startup script for Tomcat, the Apache Servlet Engine 
<br>
# 
<br>
# chkconfig: - 84 16 
<br>
# description: Tomcat Servlet Engine 
<br>
# processname: tomcat 
<br>
# pidfile: /var/run/worker1.pid /var/run/worker2.pid 
<br>
<br>
# Source function library. 
<br>
. /etc/rc.d/init.d/functions 
<br>
<br>
# User under which tomcat will run 
<br>
TOMCAT_USER=tomcat 
<br>
<br>
RETVAL=0 
<br>
<br>
CATALINA_HOME='${CATALINA_HOME}' 
<br>
WORKER_ROOT='${WORKER_ROOT}' 
<br>
WORKER_LIST=( worker1 worker2 ) 
<br>
WORKER_PORT=( 8105 8205 ) 
<br>
<br>
# start, debug, stop, and status functions 
<br>
start() { 
<br>
 i=$1 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 if [ $SHUTDOWN_PORT -ne 0 ]; then 
<br>
 echo "Tomcat ${WORKER_LIST[i]} already started" 
<br>
 else 
<br>
 echo "Starting tomcat ${WORKER_LIST[i]}..." 
<br>
 CATALINA_BASE="$WORKER_ROOT/${WORKER_LIST[i]}" 
<br>
 chown -R $TOMCAT_USER:$TOMCAT_USER $CATALINA_HOME 
<br>
 chown -R $TOMCAT_USER:$TOMCAT_USER $WORKER_ROOT 
<br>
 su -l $TOMCAT_USER -c "export CATALINA_BASE=$CATALINA_BASE; $CATALINA_HOME/bin/startup.sh" 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 while [ $SHUTDOWN_PORT -eq 0 ]; do 
<br>
 sleep 1 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 done 
<br>
 echo "Tomcat ${WORKER_LIST[i]} started in normal mode" 
<br>
 RETVAL=$? 
<br>
 [ $RETVAL = 0 ] &amp;&amp; touch /var/lock/subsys/${WORKER_LIST[i]} /var/run/${WORKER_LIST[i]}.pid 
<br>
 fi 
<br>
} 
<br>
<br>
debug() { 
<br>
 i=$1 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 if [ $SHUTDOWN_PORT -ne 0 ]; then 
<br>
 echo "Tomcat ${WORKER_LIST[i]} already started" 
<br>
 else 
<br>
 echo "Starting tomcat ${WORKER_LIST[i]} in debug mode..." 
<br>
 CATALINA_BASE="$WORKER_ROOT/${WORKER_LIST[i]}" 
<br>
 rm -rf $CATALINA_BASE/work/* 
<br>
<br>
 chown -R $TOMCAT_USER:$TOMCAT_USER $CATALINA_HOME 
<br>
 chown -R $TOMCAT_USER:$TOMCAT_USER $WORKER_ROOT 
<br>
 su -l $TOMCAT_USER -c "export CATALINA_BASE=$CATALINA_BASE; $CATALINA_HOME/bin/catalina.sh jpda start" 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 while [ $SHUTDOWN_PORT -eq 0 ]; do 
<br>
 sleep 1 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 done 
<br>
 echo "Tomcat ${WORKER_LIST[i]} started in debug mode" 
<br>
 RETVAL=$? 
<br>
 [ $RETVAL = 0 ] &amp;&amp; touch /var/lock/subsys/${WORKER_LIST[i]} /var/run/${WORKER_LIST[i]}.pid 
<br>
 fi 
<br>
} 
<br>
<br>
stop() { 
<br>
 i=$1 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 if [ $SHUTDOWN_PORT -eq 0 ]; then 
<br>
 echo "Tomcat ${WORKER_LIST[i]} already stopped" 
<br>
 else 
<br>
 echo "Stopping tomcat ${WORKER_LIST[i]} ..." 
<br>
 CATALINA_BASE="$WORKER_ROOT/${WORKER_LIST[i]}" 
<br>
 su -l $TOMCAT_USER -c "export CATALINA_BASE=$CATALINA_BASE; $CATALINA_HOME/bin/shutdown.sh" 
<br>
 SHUTDOWN_PORT=`ps -ef|grep ${WORKER_LIST[i]}|grep -v grep|wc -l` 
<br>
 while [ $SHUTDOWN_PORT -ne 0 ]; do 
<br>
 sleep 1 
<br>
 SHUTDOWN_PORT=`ps -ef|grep ${WORKER_LIST[i]}|grep -v grep|wc -l` 
<br>
 done 
<br>
 echo "Tomcat ${WORKER_LIST[i]} stopped" 
<br>
 RETVAL=$? 
<br>
 [ $RETVAL=0 ] &amp;&amp; rm -f /var/lock/subsys/${WORKER_LIST[i]} /var/run/${WORKER_LIST[i]}.pid 
<br>
 fi 
<br>
} 
<br>
<br>
status() { 
<br>
 for (( i = 0 ; i &lt; ${#WORKER_LIST[@]} ; i++ )) 
<br>
 do 
<br>
 SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep ${WORKER_PORT[i]}|wc -l` 
<br>
 if [ $SHUTDOWN_PORT -eq 0 ]; then 
<br>
 echo "Tomcat ${WORKER_LIST[i]} stopped" 
<br>
 else 
<br>
 MODE="normal" 
<br>
 JPDA_PORT=`netstat -vatn|grep LISTEN|grep 8000|wc -l` 
<br>
 if [ $JPDA_PORT -ne 0 ]; then 
<br>
 MODE="debug" 
<br>
 fi 
<br>
 echo "Tomcat ${WORKER_LIST[i]} running in $MODE mode" 
<br>
 fi 
<br>
 done 
<br>
} 
<br>
<br>
case "$1" in 
<br>
 start) 
<br>
 start 0 
<br>
 start 1 
<br>
 ;; 
<br>
 debug) 
<br>
 debug 0 
<br>
 debug 1 
<br>
 ;; 
<br>
 stop) 
<br>
 stop 0 
<br>
 stop 1 
<br>
 ;; 
<br>
 restart) 
<br>
 stop 0 
<br>
 start 0 
<br>
 stop 1 
<br>
 start 1 
<br>
 ;; 
<br>
 redebug) 
<br>
 stop 0 
<br>
 debug 0 
<br>
 stop 1 
<br>
 debug 1 
<br>
 ;; 
<br>
 status) 
<br>
 status 
<br>
 ;; 
<br>
 *) 
<br>
 echo "Usage: $0 {start|debug|stop|restart|redebug|status}" 
<br>
 exit 1 
<br>
esac 
<br>
<br>
exit $RETVAL' &gt; /etc/rc.d/init.d/tomcat 
<br>
<br>
chmod 755 /etc/rc.d/init.d/tomcat 
<br>
chkconfig --add tomcat 
<br>
chkconfig --level 235 tomcat on 
<br>
<br>
echo 'chkconfig tomcat off' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
echo 'chkconfig --del tomcat' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
echo 'rm -rf /etc/rc.d/init.d/tomcat' &gt;&gt; ${SETUP_DIR}/cleanup.sh 
<br>
<br>
chmod 755 ${SETUP_DIR}/cleanup.sh 
<br>
<br>
echo 'Tomcat installation is completed!' 
<br>
echo 
<br>
echo 'You can type "service tomcat start" to start using tomcat now.' 
<br>
echo 'You can type "service httpd start" to start using apache now.' 
<br>
echo 'Open a browser, and go to http://'${hostname}' to see it.' 
<br>
<br>
# 
<br>
# modify web.xml for cluster test 
<br>
# 
<br>
sed -i -e "27a\ &lt;distributable/&gt;" ${WEBAPP_ROOT}/${hostname}/WEB-INF/web.xml 
<br>
<br>
# 
<br>
# generate clustertest.jsp for cluster test 
<br>
# 
<br>
echo '&lt;%@ page contentType="text/html; charset=UTF-8" import="java.util.*"%&gt; 
<br>
&lt;html&gt; 
<br>
&lt;head&gt; 
<br>
&lt;title&gt;Cluster Session Replication Test&lt;/title&gt; 
<br>
&lt;/head&gt; 
<br>
&lt;body&gt; 
<br>
&lt;% 
<br>
 out.println("Session ID=" + session.getId() + "&lt;br&gt;"); 
<br>
<br>
 String key = request.getParameter("key"); 
<br>
 if (key != null &amp;&amp; key.length() &gt; 0) { 
<br>
 String value = request.getParameter("value"); 
<br>
 session.setAttribute(key, value); 
<br>
 } 
<br>
<br>
 out.println("&lt;b&gt;Session Listing&lt;/b&gt;&lt;br&gt;"); 
<br>
<br>
 Enumeration e = session.getAttributeNames(); 
<br>
 while (e.hasMoreElements()) { 
<br>
 String name = (String) e.nextElement(); 
<br>
 String value = (String)session.getAttribute(name); 
<br>
 out.println(name + " = " + value + "&lt;br&gt;"); 
<br>
 } 
<br>
%&gt; 
<br>
<br>
 &lt;form method="post"&gt; 
<br>
 key:&lt;input type="text" size="20" name="key"&gt; 
<br>
<br>
 value:&lt;input type="text" size="20" name="value"&gt; 
<br>
<br>
 &lt;input type="submit"&gt; 
<br>
 &lt;/form&gt; 
<br>
&lt;/body&gt; 
<br>
&lt;/html&gt;' &gt; ${WEBAPP_ROOT}/${hostname}/clustertest.jsp 
<br>
[/code] 
<br>
<br>
4.Then you can use the following two commands to do step12 
<br>
service tomcat start 
<br>
service httpd start 
<br>
5. For testing, you can use the following command to shutdown or startup a single Tomcat worker: 
<br>
su -l tomcat -c "export CATALINA_BASE=/var/robust/worker1; /var/tomcat6/bin/shutdown.sh" 
<br>
su -l tomcat -c "export CATALINA_BASE=/var/robust/worker1; /var/tomcat6/bin/startup.sh" 
<br>
su -l tomcat -c "export CATALINA_BASE=/var/robust/worker2; /var/tomcat6/bin/shutdown.sh" 
<br>
su -l tomcat -c "export CATALINA_BASE=/var/robust/worker2; /var/tomcat6/bin/startup.sh" 
<br>
<br>
Or you may use a shell script to restart Tomcat repeatedly to verify if the session replication really works. 
<br>
[b]restart.sh[/b] 
<br>
[code] 
<br>
 for (( i = 0 ; i &lt; 10 ; i++ )) 
<br>
 do 
<br>
 service tomcat restart 
<br>
 done 
<br>
[/code] 
<br>
<br>
If you can see all of the session objects no matter how Tomcat is restarted, then Tomcat clustering(session replication) is done. 
<br>
<br>
Note: If you have enabled firewall like iptables, please add [color=red]45564:udp[/color] port to the allowed list. 
<br>
<br>
6. Finally, browse https://&lt;your_server_ip&gt;/ to check SSL works. You have to add this site as your trust site because we use a self-signed SSL certificate. 
<br>
<br>
Reference: 
<br>
http://tomcat.apache.org/connectors-doc/reference/apache.html 
<br>
http://tomcat.apache.org/connectors-doc/generic_howto/loadbalancers.html 
<br>
http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html 
<br>
http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html 
<br>
http://tomcat.apache.org/tomcat-6.0-doc/logging.html 
<br>
http://www.easywayserver.com/implementation-tomcat-clustering.htm]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/592.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/592.page</link>
				<pubDate><![CDATA[Sat, 25 Apr 2009 17:53:53]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 呃 我下載了好幾次了 
<br>
都不能執行耶 都會出現 
<br>
沒有此一檔案或目錄!!!!]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/597.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/597.page</link>
				<pubDate><![CDATA[Mon, 11 May 2009 09:13:02]]> GMT</pubDate>
				<author><![CDATA[ yahoobread]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 我今天自己下載執行了一次發現錯誤訊息大致如下: 
<br>
sed: can't read /var/robust/worker1/conf/web.xml: 沒有此一檔案或目錄 
<br>
cp: 無法 stat ‘/var/robust/worker1/conf/web.xml’: 沒有此一檔案或目錄 
<br>
<br>
主要原因是下載來源apache.ntu.edu.tw這台主機出了問題，將第67行的參數調整為 
<br>
MIRROR_HOST=apache.stu.edu.tw 
<br>
即可正常執行了。 
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/598.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/598.page</link>
				<pubDate><![CDATA[Mon, 11 May 2009 13:12:40]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 請問版大， 
<br>
<br>
這個sh可以在其他linux版本使用嗎？ubuntu,opensuse...? 
<br>
<br>
謝謝您～]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/618.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/618.page</link>
				<pubDate><![CDATA[Wed, 1 Jul 2009 09:46:39]]> GMT</pubDate>
				<author><![CDATA[ fordsupr]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ fordsupr您可以下載後自行測試看看就知道了。 
<br>
可能會遇到軟體安裝路徑不相同的問題，您再自行調整一下。]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/619.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/619.page</link>
				<pubDate><![CDATA[Wed, 1 Jul 2009 23:58:29]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 安道森大~~請問一下我用CentOS5.2 
<br>
<br>
在安裝完Cent5.2後直接下指令 
<br>
<br>
sh httpd2_tomcat6-setup.sh 
<br>
<br>
這樣能夠讓JSP環境建置起來嗎?]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/622.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/622.page</link>
				<pubDate><![CDATA[Sun, 5 Jul 2009 23:10:06]]> GMT</pubDate>
				<author><![CDATA[ papaisno1]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ papaisno1您好，在CentOS 5.2上去跑應該是可以的。前提是連Internet的網路要是通的才行。 
<br>
一般我會在裝完CentOS 5.2之後，再執行yum -y update讓它升級到CentOS 5.3，再來執行我的安裝程式。 
<br>
<br>
我的建議是，您可以自己先試試看，驗證一下。如果遇到問題再來版上討論或發表解決您解決的方法。 
<br>
相信經過這樣子的過程您一定會很有收穫。]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/623.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/623.page</link>
				<pubDate><![CDATA[Sun, 5 Jul 2009 23:23:24]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ Dear 安大 : 
<br>
 小弟有個小建議,請安大別介意 
<br>
 在許多的伺服器設定上,是會有多條件考量的 
<br>
 安大應該是shell scrip功力極強的愛好者,且太疼愛使用者了 
<br>
 您的script檔可以迅速產出結果,但很多設定只有結果,卻依然沒人了解,為何要這樣設定 
<br>
 也許您有說明,但夾雜在script中閱讀性就降低了,反而折損了您的美意 
<br>
 這已不是給魚不給釣竿了,反而像是要吃魚給魚丸(反正也是於,不用知道是哪種魚做的,連殺魚拔刺都免了) 
<br>
 因為有許多設定知道如何設定的原理後,變化自可因事置宜 
<br>
 即便設定檔不小,但複製貼上搞不好比run shell script產生檔案還快]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/675.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/675.page</link>
				<pubDate><![CDATA[Thu, 22 Oct 2009 02:18:39]]> GMT</pubDate>
				<author><![CDATA[ answers]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ Dear answers： 
<br>
感謝您的建議，以後會再補充這方面的文章或朝這方面改進。 
<br>
<br>
以下容我解釋一下，會寫成這樣，基本上是時間考量，因為要做到像[url=http://linux.vbird.org/]鳥哥[/url]一樣，得花不少時間，所以，如果別人的基本教學文件已經寫得很清楚了，我就直接放個連結，讓大家自己連過去看，我這邊只說明加工或是整合的部分。也許，這樣子的服務品質是不夠的，我會再多花點時間去整理我的心得，讓大家瞭解。 
<br>
<br>
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/676.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/676.page</link>
				<pubDate><![CDATA[Thu, 22 Oct 2009 09:34:06]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ bash: ./httpd2_tomcat6-setup.sh: /bin/bash^M: bad interpreter: 沒有此一檔案或目錄 
<br>
出現上述的錯誤訊息 重抓過也改過MIRROR_HOST=apache.stu.edu.tw 
<br>
還是無效]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/804.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/804.page</link>
				<pubDate><![CDATA[Wed, 14 Apr 2010 18:07:27]]> GMT</pubDate>
				<author><![CDATA[ sentrasd]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ sentrasd您好： 
<br>
 我不確定是不是因為JDK版本更新到Update 19造成找不到JDK安裝檔的問題，我已經更新了我的shell script，把安裝JDK的動作抽離出來。請重新下載一次我更新後的shell script，並手動安裝一下JDK，再執行httpd2_tomcat6-setup.sh看看。]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/805.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/805.page</link>
				<pubDate><![CDATA[Wed, 14 Apr 2010 22:43:43]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 謝謝版大特地幫我修改了一個版本, 
<br>
試的結果還是會出現那個訊息, 
<br>
結果再上網查了一下可能是fileformat=dos, 
<br>
所以不管三七二十一就下了dos2unix httpd2_tomcat6-setup.sh 
<br>
結果真的就順利安裝完成, 
<br>
所以原本含JDK的安裝版本有可能也是相同狀況, 
<br>
提供給各位參考,再次謝謝版大的支援 :D]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/806.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/806.page</link>
				<pubDate><![CDATA[Thu, 15 Apr 2010 15:31:49]]> GMT</pubDate>
				<author><![CDATA[ sentrasd]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ sentrasd您好: 
<br>
 原來是這個小問題（印象中出現^M這個符號好像都是這類的問題)，我已將檔案轉換為UNIX格式了。]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/807.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/807.page</link>
				<pubDate><![CDATA[Thu, 15 Apr 2010 19:02:20]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Re:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ Thanks for superb script. I have successfully tested it on my server. Now I would like to deploy my application war file. how do I do that? 
<br>
If I place it in /var/webapps/ it is not deploying. 
<br>
<br>
can you elaborate it . I know everyone would need this information. 
<br>
<br>
once again thanks in advance. 
<br>
<br>
you are the master!!!]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/928.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/928.page</link>
				<pubDate><![CDATA[Mon, 6 Dec 2010 15:39:37]]> GMT</pubDate>
				<author><![CDATA[ k.irfee]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ Dear k.irfee, 
<br>
In short, 
<br>
 1. You need to create a new site under /var/webapps, for example, www.yourcompany.com. 
<br>
mkdir -p /var/webapps/www.yourcompany.com 
<br>
 2. You need to modify both the server.xml files of Tomcat worker1 and worker2 in /var/robust/worker[1-2]/conf/server.xml. Add a new &lt;Host&gt; for www.yourcompany.com. And add a &lt;Context&gt; inside that &lt;Host&gt;. 
<br>
 3. You can place your web application files under the above directory. 
<br>
<br>
For detail, please check the following post (Sorry it's in Chinese): 
<br>
http://www.andowson.com/posts/list/309.page]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/929.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/929.page</link>
				<pubDate><![CDATA[Mon, 6 Dec 2010 23:37:15]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Re:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ I have tried your given suggestion , but my tomcat doesn't start. I have added host element in server.xml of both workers. also created /var/webapps/domainname directory. 
<br>
<br>
even I can't see anything in catalina.out it is blank. 
<br>
<br>
new virtualhost part from server.xml 
<br>
<br>
<br>
&lt;Host name="mycomp.khan.com" appBase="" 
<br>
 unpackWARs="true" autoDeploy="true"&gt; 
<br>
 &lt;Valve className="org.apache.catalina.valves.AccessLogValve" 
<br>
 directory="logs" prefix="mycomp.khan.com_access_log." suffix=".txt" 
<br>
 pattern="combined" resolveHosts="false"/&gt; 
<br>
 &lt;Context path="" docBase="webapps/mycomp.khan.com" reloadable="false" /&gt; 
<br>
<br>
<br>
<br>
<br>
I need to use webapp folder as default setup. like, in a default tomcat setup we just need to copy application war file and then it will get unpacked by tomcat . same way it can have multiple application war file deployed. 
<br>
<br>
please help! 
<br>
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/931.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/931.page</link>
				<pubDate><![CDATA[Thu, 9 Dec 2010 19:40:58]]> GMT</pubDate>
				<author><![CDATA[ k.irfee]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ Dear k.irfee, 
<br>
 I have tried to deploy a demo.war in my host. It's very easy to do so. Just use the Tomcat's manager application. And if you followed my setup script, the Tomcat manager application should have already been installed. All you need to do is to find out the manager's password(username is "manager"). 
<br>
<br>
Follow the steps and you should be successfully deploy the demo.war and see the output of "Hello, world!": 
<br>
1.Check the file /var/robust/worker1/conf/tomcat-users.xml and you can see the username and password of the role "manager". (You can modify it to suit your own need.) 
<br>
2.Open a browser, and go to the URL: http://&lt;your_server_ip&gt;/manager/html. Tomcat will ask you to enter the username and password, use the information from step 1. 
<br>
3.Go to the "WAR file to deploy" section, and click the browse button at the "Select WAR file to upload" field, choose the demo.war and then click the Deploy button. 
<br>
4.Click on the /demo link. 
<br>
<br>
Note: 
<br>
1.Check the file /var/robust/worker1/conf/server.host, 
<br>
Your &lt;Host&gt; should look like the following example: 
<br>
[code] 
<br>
&lt;Host name="192.168.1.1" appBase="webapps/192.168.1.1" 
<br>
 unpackWARs="true" autoDeploy="true"&gt; 
<br>
 &lt;Valve className="org.apache.catalina.valves.AccessLogValve" 
<br>
 directory="logs" prefix="192.168.1.1_access_log." suffix=".txt" 
<br>
 pattern="combined" resolveHosts="false"/&gt; 
<br>
 &lt;Context path="" docBase="" reloadable="false" /&gt; 
<br>
&lt;/Host&gt;[/code] 
<br>
2.Check the permission of /var/webapps/&lt;your_server_ip&gt;, it should be writable by tomcat. Use the following command to fix it. 
<br>
chown -R tomcat:tomcat /var/webapps/&lt;your_server_ip&gt; 
<br>
<br>
Reference: 
<br>
http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/933.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/933.page</link>
				<pubDate><![CDATA[Fri, 10 Dec 2010 00:40:10]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 您好: 
<br>
<br>
我照這篇文章去作了設定 
<br>
<br>
worker1 worker2 與 httpd 都能正常start 
<br>
<br>
但是我打http://localhost/ 依舊是point到httpd自己的web 
<br>
<br>
打http://localhost/clustertest.jsp 
<br>
<br>
出現 Service Temporarily Unavailable 
<br>
<br>
然後/var/webapps 裡的東西都無法access 不知道怎麼解決 
<br>
<br>
希望大大的幫忙]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/978.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/978.page</link>
				<pubDate><![CDATA[Wed, 9 Mar 2011 11:34:53]]> GMT</pubDate>
				<author><![CDATA[ caramel]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ caramel您好: 
<br>
請先檢查一下您主機的IP，然後cd /var/webapps，檢查目錄下有沒有一個跟主機IP相同的目錄 
<br>
例如主機IP是192.168.1.1，則目錄名稱應為192.168.1.1 
<br>
請改為存取下列網址看看 
<br>
http://192.168.1.1/ 
<br>
再不行請重新啟動一次Tomcat和Apache看看 
<br>
利用下列指令去檢查Tomcat是否正常啟動 
<br>
[code]netstat -an|grep 8105 
<br>
netstat -an|grep 8109[/code]]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/979.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/979.page</link>
				<pubDate><![CDATA[Wed, 9 Mar 2011 15:55:54]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 我發現原因了 
<br>
<br>
好像是SELinux在搞鬼 
<br>
<br>
我把他disable後就可以開啟了^^]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/980.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/980.page</link>
				<pubDate><![CDATA[Wed, 9 Mar 2011 20:53:57]]> GMT</pubDate>
				<author><![CDATA[ caramel]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 我已經把第一篇文章中的注意事項標註為紅色了 
<br>
[color=red]disable SELinux and firewall[/color]]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/981.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/981.page</link>
				<pubDate><![CDATA[Thu, 10 Mar 2011 18:38:46]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ 你好: 
<br>
<br>
請教一下 
<br>
我可以把session replication的功能給獨立出來嗎 
<br>
意思是我只要實現這個功能 
<br>
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/1019.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/1019.page</link>
				<pubDate><![CDATA[Tue, 7 Jun 2011 18:10:46]]> GMT</pubDate>
				<author><![CDATA[ kevinwang72326]]></author>
			</item>
			<item>
				<title>回覆:Apache 2.2 + SSL + JK 1.2 + Tomcat 6.0 Clustering Auto Installer for CentOS 5.3</title>
				<description><![CDATA[ kevinwang72326您好: 
<br>
您可以自己試試看，如果有遇到問題，再把您的做法發表上來，讓大家討論。]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/315/1063.page</guid>
				<link>https://forum.andowson.com/posts/preList/315/1063.page</link>
				<pubDate><![CDATA[Thu, 9 Jun 2011 16:53:40]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
	</channel>
</rss>