How to install Tomcat6 + Mod_JK

เริ่มต้นติดตั้ง Java และ jsvc
apt-get update
apt-get install sun-java6-jdk jsvc

ดาวน์โหลด Tomcat6
cd /usr/src

แตกไฟล์ และย้ายไปที่ /usr/share
tar zxvf apache-tomcat-6.0.29.tar.gz
cd apache-tomcat-6.0.29
apache-tomcat-6.0.29 /usr/share/tomcat6

เพิ่ม user และกำหนดสิทธิ์
useradd tomcat6
chown -R tomcat6: /usr/share/tomcat6

vi /etc/init.d/tomcat6
export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in

sh /usr/share/tomcat6/bin/


sh /usr/share/tomcat6/bin/


sh /usr/share/tomcat6/bin/
sh /usr/share/tomcat6/bin/


exit 0

chmod +x /etc/init.d/tomcat6

update-rc.d tomcat6 defaults

/etc/init.d/tomcat6 start

wget http://localhost:8080

ตั้งค่าในไฟล์ server.xml
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListen
er" />
  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListe
  <!– Global JNDI resources –>
    <!– Test entry for demonstration purposes –>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <!– Editable user database that can also be used by
         UserDatabaseRealm to authenticate users –>
    <Resource name="UserDatabase" auth="Container"
       description="User database that can be updated and saved"
          pathname="conf/tomcat-users.xml" />
  <!– Define the Tomcat Stand-Alone Service –>
  <Service name="Catalina">
    <!– A "Connector" represents an endpoint by which requests are received
         and responses are returned.  Each Connector passes requests on to the
         associated "Container" (normally an Engine) for processing.
    <!– Define a non-SSL HTTP/1.1 Connector on port 2117 (default 8080) –>
    <!– <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="5" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />–>
    <!– Define an AJP 1.3 Connector on port 8009 –>
    <Connector port="8009"
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    <!– Define a Proxied HTTP/1.1 Connector on port 8082 –>
    <!– See proxy documentation for more information about using this. –>
    <Connector port="8082"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" acceptCount="100" connectionTimeout="20000"
               proxyPort="80" disableUploadTimeout="true" />
    <!– An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host). –>
    <!– Define the top level container in our container hierarchy –>
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
      <!– Define the default virtual host –>
      <Host name="" appBase="/var/www/"
        unpackWARs="true" autoDeploy="true">
        <Context path="" docBase="appname" debug="0" reloadable="true"/>
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="example.com_access_log." suffix=".txt"
                 pattern="common" resolveHosts="false"/>
ติดตั้ง mod_jk
apt-get install libapache2-mod-jk



Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out /  เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out /  เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out /  เปลี่ยนแปลง )


Connecting to %s