tar zxf apache-tomcat-7.0.29.tar.gz -C /usr/local
cd /usr/local
mv apache-tomcat-7.0.29/ tomcat
/usr/local/tomcat/bin/startup.sh
netstat -tunlp|grep 8080
以上是安装tomcat步骤
APACHE与TOMCAT的整合
tar zxf tomcat-connectors-1.2.37-src.tar.gz
cd tomcat-connectors-1.2.37-src
cd native/
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-tomcat=/usr/local/tomcat --with-java-home=/usr/java --with-jni
make
cd apache-2.0
/usr/local/apache2/bin/apxs -i mod_jk.so
Vi /usr/local/apache2/conf/httpd.conf #在配置文件中添加如下配置
LoadModule jk_module modules/mod_jk.so
include /etc/httpd/extra/mod_jk.conf #路径可根据实际配置
vi /usr/local/apache2/conf/extra/mod_jk.conf #在配置文件中添加如下配置
#where to find workers.properties
jkWorkersFile /etc/httpd/conf/workers.properties
#Where to put jk logs
JkLogFile /usr/local/apache2/logs/mod_jk.log
#Set the jk log level [debug/error/info]
JkLogLevel info
#Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
#JkRequestLogFormat set the request format
JkRequestLogFormat "%W %V %T"
#JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
#Send JSPs for context /examples to worker named worker
JkMount /*.jsp worker1
JkMount /examples/* worker1
Vim /usr/local/apache2/conf/workers.properties #在配置文件中添加如下配置
# 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.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
修改httpd.conf做个别外记录,用于测试
Vim /usr/local/apache2/conf/httpd.conf #在配置文件中添加如下配置
#Static files in the examples webapp are seved by apache
Alias /examples "/usr/localtomcat/webapps/examples"
#The following line prohibits users from directly access WEB-INF
AllowOverride None
deny from all
#All JSP will goes to worker1
JkMount /*.jsp worker1
#All servlets goes to worker1
JkMount /*/servlet/ worker1