apache2.2 + tomcat6.0 整合 实现静态资源与动态资源的分离
前提是安装好 apache 和 tomcat
1,编写workers.properties 文件(目录--Apache\conf)内容如下:
1 workers.tomcat_home=D:/Workspaces/MyEclipse 2014/.metadata 2 workers.java_home=C:/Program Files (x86)/Java/jre1.8.0_45 3 ps=/ 4 worker.list=ajp13 5 worker.ajp13.port=8009 6 worker.ajp13.host=localhost 7 worker.ajp13.type=ajp13
2,修改 httpd.conf 配置文件, 在文件末尾添加如下代码(修改后重启apache):
1 LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.3.so 2 JKWorkersFile conf/workers.properties 3 JkLogFile logs/mod_jk.log 4 <VirtualHost localhost:80> 5 ServerAdmin localhost 6 DocumentRoot "D:/Workspaces/MyEclipse 2014/.metadata/.me_tcat/webapps" 7 ServerName localhost 8 ErrorLog logs/shsc-error_log.txt 9 CustomLog logs/shsc-access_log.txt common 10 11 <Directory "D:/Workspaces/MyEclipse 2014/.metadata/.me_tcat/webapps"> 12 Options FollowSymLinks IncludesNOEXEC Indexes 13 DirectoryIndex index.html index.htm default.htm 14 AllowOverride None 15 Order Deny,Allow 16 Allow from all 17 18 </Directory> 19 20 #JkMount /admin ajp13 21 JkMount /*.do ajp13 22 23 </VirtualHost>
注意: 1) DocumentRoot 和 Directory 对应的地址 必须与tomcat应用地址一致
2) 转发路径 必须 有后缀才能转发