透過mod_jk當connector整合apache和tomcat
環境:solaris 8(已安裝JDK和tomcat)
務必找到適合自己環境的對應版本
Apache: apache-2.2.14-sol8-sparc-local.gz from
sunfreewaremod_jk: mod_jk-1.2.28-httpd-2.2.X.so from
www.apache.orgStep 1.安裝apache./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-ssl=shared
--enable-ssl --with-ssl=/usr/local/ssl --enable-proxy --enable-proxy-connect
--enable-proxy-ftp --enable-proxy-http --with-ldap --enable-ldap
--enable-authnz-ldap
沒用到的modules可以不用裝
Step 2.加入mod_jk.so把下載好的mod_jk-1.2.28-httpd-2.2.X.so改名為mod_jk.so
移至{apache.home}/modules下就可以了
Step 3.編輯httpd.confLoadModule jk_module lib/mod_jk.so
# mod_jk settings
Include conf/mod_jk.conf
Step 4.新增mod_jk.conf於{apache.home}/conf#setup the workers.properties file path, default prefix path is httpd's home (/usr/local/httpd)
JkWorkersFile conf/workers.properties
JkLogFile /var/log/jk.log
JkShmFile /var/log/jk-runtime-status
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
# Sample JkMounts. Replace these with the paths you would
# like to mount from your JSP server.
# syntax: JkMount ${URL_DIR}/*.jsp worker_name
JkMount /project/*.jsp jsp-ap
Step 5.新增workers.properties於{apache.home}/conf# worker.list defined worker_name, used by mod_jk.conf
worker.list=jsp-ap
worker.jsp-ap.port=8009
worker.jsp-ap.host=192.168.1.154
worker.jsp-ap.type=ajp13
worker.jsp-ap.lbfactor=1
Step 6.修改{tomcat.home}/conf/server.xml<Host name="192.168.1.154" debug="0" appBase="/default" unpackWARs="true" autoDeploy="true">
<Context path="/project" docBase="/project"
debug="5" reloadable="true" crossContext="true">
</Context>
</Host>
設定完以上步驟
啟動tomcat和apache
就可以測試在80 port下是否可順利連上tomcat