日期:2014-05-16  浏览次数:21041 次

apache+tomcat配置多站点集群的方法

打开httpd.conf文件,取消下面五行的注释,用以打开代理所需的.so支持模块。
View Code
1 #LoadModule proxy_http_module modules/mod_proxy_http.so
2 #LoadModule proxy_connect_module modules/mod_proxy_connect.so
3 #LoadModule proxy_module modules/mod_proxy.so

4 #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
5 #LoadModule proxy_module modules/mod_proxy_blancer.so

取消虚拟主机的注释

#Include conf/extra/httpd-vhosts.conf

 

配置多站点集群的方法

<VirtualHost *:80>
         ServerName html580.com
         ServerAlias *.html580.com
     ProxyIOBufferSize 8192 
         ProxyRequests Off  
         ProxyVia Full  
         #ProxyPass / http://localhost:8080/ smax=5 max=20 ttl=120 retry=300
     #ProxyPass / balancer://proxy/ stickysession=jsessionid nofailover=On
    ProxyPass / balancer://proxy/  lbmethod=bytraffic
    <Proxy balancer://proxy>  
         BalancerMember http://localhost:8080/  loadfactor=15
         BalancerMember http://localhost:8081/  loadfactor=10
    </Proxy>  
</VirtualHost>

<VirtualHost *:80>
         ServerName jinjingw.com
         ServerAlias *.jinjingw.com
     ProxyIOBufferSize 8192 
         ProxyRequests Off  
         ProxyVia Full  
         ProxyPass / balancer://proxy1/  lbmethod=bytraffic
    <Proxy balancer://proxy1>  
         BalancerMember http://localhost:8082/  loadfactor=15
         BalancerMember http://localhost:8083/  loadfactor=10
    </Proxy>
         ##ProxyPassReverse /bay balancer://proxy1/
</VirtualHost>