通过http-vhosts.conf配置apache的负载均衡

一、在httpd.conf中加载如下库,并去掉Include conf/extra/httpd-vhosts.conf的注释:

二、在httpd-vhosts.conf中添加虚拟主机:

<VirtualHost *:80>
RewriteEngine On
RewriteOptions Inherit

RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_URI} ^/service_engine/jaxrs/(.*)$
RewriteRule ^/?(.*)$ https://%{SERVER_NAME}:{SSL_PORT}/$1 [L,R]

ProxyRequests Off

ProxyPass /appname balancer://appname lbmethod=byrequests stickysession=ROUTEID
ProxyPassReverse /appname balancer://appname 
<Proxy balancer://appname/>
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/appname" env=BALANCER_ROUTE_CHANGED
BalancerMember ajp://appIP:ajpPort/appname route=appname loadfactor=50 keepalive=On timeout=1800
</Proxy>

</VirtualHost>

 

Apache HTTP Server 与 Tomcat 的三种连接方式参考

你可能感兴趣的:(通过http-vhosts.conf配置apache的负载均衡)