首页 > 开发 > Apache > 正文

WIN2003上Apache2+IIS6+Tomcat5之多站点完美配置篇

2020-02-05 13:46:29
字体:
来源:转载
供稿:网友
注册会员,创建你的web开发资料库,

本来以为上一次的配置就搞定了,结果本地测试好好的,到了服务器上调试就完蛋了,本地只测试了一个asp站和一个jsp站,而实际情况是多个asp站和我的jsp站,又试了两次还是不行,终于在第三次尝试后搞定了,写下来做个纪念。

第一次尝试使用:

<virtualhost *:80>
   serveradmin [email protected]
  servername www.5hope.com
   dcumentroot "g:/5hope
   directoryindex index.html index.htm index.asp 
  proxypass / http://www.5hope.com:88/
  proxypassreverse / www.5hope.com:88/
</virtualhost>


<virtualhost *:80>
    serveradmin [email protected]
  servername www.shundabanjia.com 
  documentroot "g:/wuyubing/www"
  directoryindex index.html index.htm index.asp 
  proxypass / http://www.shundabanjia.com:88/
  proxypassreverse / http://www.shundabanjia.com:88/
</virtualhost>

本以为这样设置多站点就搞定了,结果发现只识别第一个站点,访问别的站点都是这个站的内容,折腾了一上午,没成功。

第二次尝试使用:

<virtualhost *:80>
 #添加了这个属性**********
 proxypreservehost on
serveradmin [email protected] 
  servername www.shundabanjia.com 
  documentroot "g:/wuyubing/www"
  directoryindex index.html index.htm index.asp 
  proxypass / http://www.shundabanjia.com:88/
  proxypassreverse / http://www.shundabanjia.com:88/
</virtualhost>

loadmodule jk_module modules/mod_jk.so 
jkworkersfile "d:/tomcat5.0.28/conf/workers.properties"
<virtualhost *:80>
    serveradmin [email protected]   
    servername www.openria.cn
    directoryindex index.html index.htm index.jsp
    jkmount /* ajp13   
    jkautoalias "d:/tomcat-5.0.28/webapps/ria"  
    <directory "d:/tomcat-5.0.28/webapps/ria">
       options indexes followsymlinks
       allow from all
    </directory>
</virtualhost>

这回经过查官方资料,发现了一个属性,叫proxypreservehost on,试了一下,是可以用实现多个虚拟的asp站点了,但是和我的tomcat站点定义冲突,访问不了jsp站,又不行,只好再找。

第三次尝试使用:

namevirtualhost *:80

<virtualhost *:80>
  proxypreservehost on
  serveradmin [email protected]
  servername www.shundabanjia.com 
  documentroot "g:/wuyubing/www"
  directoryindex index.html index.htm index.asp 
  proxypass / http://www.shundabanjia.com:88/
  proxypassreverse / http://www.shundabanjia.com:88/
</virtualhost>

loadmodule jk_module modules/mod_jk.so 
jkworkersfile "d:/tomcat5.0.28/conf/workers.properties"
<virtualhost *:80>
    serveradmin [email protected]   
    servername www.openria.cn
    directoryindex index.html index.htm index.jsp
    jkmount /* ajp13   
    jkautoalias "d:/tomcat-5.0.28/webapps/ria"  
    <directory "d:/tomcat-5.0.28/webapps/ria">
       options indexes followsymlinks
       allow from all
    </directory>
</virtualhost>

经过反复看文档,这回终于搞定了,原来是没有吧"use name-based virtual hosting."打开,去掉namevirtualhost *:80前面的#号就可以了,真是晕啊。

总算成功了,看来有问题还需要看官方资料啊,网友的资料还是不完整啊,通过自己的努力,发现新的线索:

proxypreservehost on
namevirtualhost *:80
这也是自己的收获啊,希望这些经历能帮助需要他的人。

再次庆祝一下,自己的网站终于要开通了,欢迎访问:www.openria.cn

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表