Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Load balancing Apache
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
yarug
Tux's lil' helper
Tux's lil' helper


Joined: 01 Dec 2004
Posts: 117
Location: NL

PostPosted: Tue Aug 01, 2006 9:26 pm    Post subject: [Solved] Load balancing Apache Reply with quote

Hi,

I've been trying to configure Apache's balancer proxy, but have not had any
luck. I've been trying to configure a load balancing proxy that forwards
requests to 2 web servers. I want both http and https requests to be
forwarded. (Actually, the forwarded requests do not need to be https as they are routed over the LAN)

A simple picture of what I want:

Internet HTTP/HTTPS-->

--------------------------------------
| Box 1: (Apache) Load balancer | -->
--------------------------------------
--------------------------
| Box 2: Web server 1 |
--------------------------
--------------------------
| Box 3: Web server 2 |
--------------------------

I started with the following configuration in /etc/apache/httpd.conf:

ProxyPass /awstats !
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=jsessionid
ProxyPreserveHost On

<Proxy balancer://mycluster/>
BalancerMember http://192.168.0.2:80
BalancerMember http://192.168.0.3:80
</Proxy>

This worked fine, but ofcourse not for https requests. I then removed the
above configuration from httpd.conf and placed it in the default vhost
configuration at /etc/apache2/vhosts.d/00_default_vhost.conf:

ProxyPass /awstats !
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=jsessionid
ProxyPreserveHost On

<Proxy balancer://mycluster/>
BalancerMember http://192.168.0.2:80
BalancerMember http://192.168.0.3:80
</Proxy>

I then configured the default ssl virtual host simularly
(/etc/apache2/modules.d/41_mod_ssl.default-vhost.conf):

ProxyPass / balancer://mysslcluster/ stickysession=jsessionid
ProxyPreserveHost On

<Proxy balancer://mysslcluster/>
BalancerMember https://192.168.0.2:443
BalancerMember https://192.168.0.3:443
</Proxy>

But now I cannot get my requests to the balancer handled by one of the web
servers (i.e. the request is not forwarded). An http request is forwarded to
the web servers, but an https request is giving an Internal Server Error.

https requests seem never been forwarded to the balancer members. I can see the request coming in on the load balancer, but no requests are logged by any of the two balancer members. As for http requests I can see the requests coming in on the load balancer and then in the logs of one of the two balancer members.

Can someone please comment on the above configuration and tell me what I'm
doing wrong?

Many thanks,
Nes


Last edited by yarug on Mon Aug 07, 2006 8:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
rafo
Apprentice
Apprentice


Joined: 18 Nov 2003
Posts: 161
Location: Sollentuna, Sweden

PostPosted: Sat Aug 05, 2006 11:24 am    Post subject: Reply with quote

This may not be what you want to do, but an alternative could be to set up load balancing that is not aware of Apache in particular. There is a website that explains it all: http://www.linuxvirtualserver.org/.

Many months ago I did some protoyping work with a load balancer of the "LVS-NAT" variety running on a Gentoo box. All the software that I needed was in Portage and as I remember it everything just worked as promised.
Back to top
View user's profile Send private message
yarug
Tux's lil' helper
Tux's lil' helper


Joined: 01 Dec 2004
Posts: 117
Location: NL

PostPosted: Sat Aug 05, 2006 6:59 pm    Post subject: Reply with quote

Thank you for your reply. I'll have a look at the site you suggested.
Back to top
View user's profile Send private message
yarug
Tux's lil' helper
Tux's lil' helper


Joined: 01 Dec 2004
Posts: 117
Location: NL

PostPosted: Mon Aug 07, 2006 8:09 pm    Post subject: [Solved] Load balancing Apache Reply with quote

Solved by putting:

SSLProxyEngine on

in /etc/apache2/modules.d/41_mod_ssl.default-vhost.conf.

Many thanks,
Nes
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum