Re: [squid-users] Using squid 2.4 as an accelerator

From: Brendan Keessen <brendan@dont-contact.us>
Date: Mon, 10 Dec 2001 17:15:40 +0100

Hello Dustin,

On Mon, Dec 10, 2001 at 10:13:18AM -0600, Dustin Puryear wrote:
> Any help on the following? I don't see in the Squid documentation where they
> go over all of the details of setting up IP-based virtual hosting with
> Squid. The docs only get so far as "httpd_accel_host virtual" and then
> pretty much drop it.

For listening on port 80 on all your interfaces you can use the following:

http_port 0.0.0.0:80

Or you may specify multiple socket addresses on multiple lines.

Then as you describe in your email:

httpd_accel_host virtual
httpd_accel_port 80

And for redirecting the requests to the correct realserver you have to
make use of the following directives:

redirect_program /usr/local/bin/squid_redirect.pl
redirect_children 30
redirect_rewrites_host_header off

A simple version of a redirect program:

c26133% cat /usr/local/bin/squid_redirect.pl
#!/usr/bin/perl
use strict;

$|=1;
while (<>) {
        s@http://<virtual servername>@http://<real servername>@;
        print;
}

I hope this works for you.

Greetings,

Brendan

>
> So I setup the IP aliases on the Squid box. But how do I tell Squid which
> web servers behind it to use? We want to spread the accesses over n
> webservers.
>
> Any help would be appreciated, thanks.
>
> Regards, Dustin
>
> ---
> Dustin Puryear <dpuryear@usa.net>
> Information Systems Consultant
> http://members.telocity.com/~dpuryear
> In the beginning the Universe was created.
> This has been widely regarded as a bad move. - Douglas Adams
>
>
> > -----Original Message-----
> > From: Dustin Puryear [mailto:dpuryear@usa.net]
> > Sent: Sunday, December 09, 2001 4:27 PM
> > To: squid-users@squid-cache.org
> > Subject: [squid-users] Using squid 2.4 as an accelerator
> >
> >
> > I am looking to use Squid 2.4 as a web accelerator in front of n
> > webservers.
> > Squid will be running on a FreeBSD 4.4-RELEASE based firewall that only
> > allows incoming port 80. Our web service will be using IP- and name-based
> > virtual hosting.
> >
> > I am a bit confused on how to setup the virtual hosting with Squid. I know
> > that I need to specify 'virtual' for the httpd_accel_host option. However,
> > where do I go from there?
> >
> > Based on what I've learned I intend on using only private network
> > addresses
> > inside the network, so webserver 1 would be 10.0.0.10, webserver
> > 2 would be
> > 10.10.0.11, and so on. In addition, I will setup the IP aliases on the
> > public interface on our firewall for each IP-based virtual host
> > that we will
> > support. But how do I configure Squid to know where to send these request?
> > Since I am not specifying a hostname in httpd_accel_host I don't
> > see where I
> > would specify the webserver addresses.
> >
> > Please note that each web server will be serving the same content as any
> > other web server, and at this time we plan on using DNS round robin to
> > load-share. My current configuration is below. All comments are welcome.
> >
> > Also, is there anything special that needs to be done to Apache other than
> > adding the virtual host entries in httpd.conf? What about interface
> > configuration on the webservers?
> >
> > Regards, Dustin
> >
> > [--begin--]
> > ##
> > # General configuration
> >
> > # Specify the port we will listen on
> > http_port 80
> >
> > # Specify the user to run as
> > cache_effective_user squid
> > cache_effective_group squid
> >
> > ##
> > # ACL's
> >
> > acl all src 0.0.0.0/0.0.0.0
> > acl LocalNet src 10.0.0.0/255.255.255.0
> > acl AccelHost dst 10.0.0.0/255.255.255.0
> > acl AccelPort port 80
> >
> > # Allow anything to our accelerated hosts on port AccelPort
> > http_access allow AccelHost AccelPort
> > # Allow anything from our local network
> > http_access allow LocalNet
> > # Deny everything else
> > http_access deny all
> >
> > ##
> > # Setup Accelerator mode
> >
> > httpd_accel_host virtual
> > httpd_access_port 80
> > httpd_accel_uses_host_header on
> > [--end--]
> >
> > ---
> > Dustin Puryear <dpuryear@usa.net>
> > Information Systems Consultant
> > http://members.telocity.com/~dpuryear
> > In the beginning the Universe was created.
> > This has been widely regarded as a bad move. - Douglas Adams
> >
> >
> >
Received on Mon Dec 10 2001 - 09:15:47 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:05:17 MST