linux的apache加入virtual host后就不能处理jsp了
我的linux下的apache加入虚拟机后就不能经过mod_jk.so把jsp交给tomcat处理了,但如果不加入虚拟机是可以正常处理的。有谁知道为什么吗?基本配置如下:
1、httpd.conf中,修改了如下
....
ServerName www.mrzhangtufu.com
....
DocumentRoot "/usr/web/test"
.....
<Directory "/usr/web/test">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
.....
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
......
Include conf/mod_jk.conf
2、mod_jk.conf内容如下:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkMount /*.jsp controller
3、workers.properties内容如下:
#server list
worker.list=controller,tomcat1,tomcat2
#=======tomcat1========
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1
#========tomcat2============
worker.tomcat2.port=9009
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.controller.type=lb
worker.controller.balanced_workers=tomcat1,tomcat2
worker.controller.sticky_session=1
4、httpd-vhosts.conf中的虚拟机内容:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.mrzhangtufu.com
DocumentRoot /usr/web/test
</VirtualHost>
5、tomcat的server.xml中host内容如下:
<Host name="www.mrzhangtufu.com"
appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path=""
docBase="/usr/web/test"
debug="0" reloadable="true" crossContext="true"/>
</Host>
测试的 /usr/web/test/index.jsp 内容:
<%
out.println("dddddddddd");
%>
测试时输出全部内容,即没有经过tomcat处理就输出,但如果没有加入虚拟机,即将httpd.conf
的Include conf/extra/httpd-vhosts.conf注释掉,则正常输出dddddddddd。到底为何这样?