apche整合tomcat


apache处理html静态内容
原理架构:
apache解析静态web内容
不能解析的内容,让mod_jk交由app server去处理

1 下载:
地址为:http://archive.apache.org/dist/tomcat/tomcat-


connectors/jk/binaries/win32/jk-1.2.31/


2 将mod_jk-1.2.31-httpd-2.2.3.so放到D:\tools\Apache Software


Foundation\Apache2.2\modules


3 修改httpd.conf
添加Include conf/mod_jk.conf


4 在同级目录下新建mod_jk.conf
添加内容:
LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.3.so

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
<VirtualHost *>
ServerAdmin localhost
DocumentRoot F:/code
ServerName localhost
DirectoryIndex index.html index.htm index.jsp index.action
ErrorLog logs/shsc-error_log.txt
CustomLog logs/shsc-access_log.txt common

JkMount /*WEB-INF localworker1
JkMount /*.action localworker1
JkMount /servlet/* localworker1
JkMount /*.jsp localworker1
JkMount /*.do localworker1
JkMount /*.action localworker1
JkMountFile "conf/uriworkermap.properties"
</VirtualHost>

5 在同级目录新建 workers.propertie
添加内容如下:
workers.tomcat_home=C:\Java\apache-tomcat-7.0.2
workers.java_home=C:\Java\jdk1.7.0_07


#workers中可以定义多个worker
worker.list=localworker1
worker.localworker1.port=8009 #默认端口号
worker.localworker1.host=localhost #tomcat服务器地址
worker.localworker1.type=ajp13 #使用ajp/1.3协议连接






6 在同级目录新建 uriworkermap.properties
/*=localworker1


# 静态文件不由任何worker处理,交给apache httpd
/*.css=localworker1
/*.js=localworker1
!/*.gif=*
!/*.jpg=*
!/*.png=*
!/*.htm=*
!/*.html=*

你可能感兴趣的:(apache,tomcat,Web)