整合Apache和Tomcat

下载mod_jk模块, 放到apache的modules目录下. 然后创建一个mod_jk.conf文件.

LoadModule jk_module modules/mod_jk.so
JkWorkersFile $TOMCAT_HOME/conf/workers.properties
JkLogFile $TOMCAT_HOME/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JkMount /webchart/* worker1

创建上面提到的workers.properties文件, 内容如下所示.

workers.tomcat_home=$TOMCAT_HOME
workers.java_home=$JAVA_HOME
ps=/
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300

再启动Tomcat.

export JAVA_OPTS=-Djava.awt.headless=true
./startup.sh

在Apache的配置文件中, 加入mod_jk.conf文件.

include "/path/mod_jk.conf"

再重启一下Apache就好了.

你可能感兴趣的:(apache,html,tomcat,.net,socket)