Apache + Tomcat 负载均衡集群配置问题 404错误(解决方法)

启动Apache 和Tomcat 然后发现我的一切都很正常,但是发现可以再本机通过localhost(127.0.0.1)访问,但是不能通过IP访问。
    查了各方面资料,对在这个问题的搜索过程中出现的各种回答都试过了,没有一个能解决我问题的回答。最后发现问题在这:
在httped.conf中打开了#Include conf/extra/httpd-vhosts.conf这个配置,但是在extra/httpd-vhosts.conf这个问题件中虚拟主机添加错误:

 1 <VirtualHost *:80>  
 2     ServerAdmin webmaster@dummy-host.ygsoft.com 
 3     ServerName 127.0.0.1  //这里,应该配置为自己的实际IP,负责不能通过IP来访问服务器,提示错误404
 4     ServerAlias localhost  
 5     ProxyPass / balancer://ygsoftcluster/ stickysession=JSESSIONID|jsessionid scolonpathdelim=On nofailover=On
 6     ProxyPassReverse / balancer://ygsoftcluster/
 7     ErrorLog "logs/ygsoftcluster-error.log"  
 8     CustomLog "logs/ygsoftcluster-access.log" common
 9 
10 <proxy balancer://ygsoftcluster>  
11   BalancerMember http://127.0.0.1:7070/ loadfactor=1 route=tomcat1
12   BalancerMember http://127.0.0.1:8080/ loadfactor=1 route=tomcat2
13   BalancerMember http://127.0.0.1:9090/ loadfactor=10 route=tomcat3
14   #ProxySet stickysession=ROUTEID
15   ProxySet lbmethod=bytraffic 
16 </proxy>
17 </VirtualHost>

改为自己的IP,问题迎刃而解。

posted @ 2013-03-19 22:08  haycco  阅读(975)  评论(0编辑  收藏  举报