Gustavo Araujo Bittencourt wrote:
>
> I read the information on how to set squid as a Web-Accelerator for 2 web
> servers. It is necessary to install a custom Perl script on the squid
> server, but I did not understand where should I add this script (how to add
> this script).
Both yes and no. If it is acceptable that the servers are handled as
virtual domains sharing the same internet IP address then you do not
need a redirector, and can instead use a local host table or DNS zone to
tell Squid how to contact the backend servers. The key issue is that for
each domain accelerated Squid needs to be able to find out which IP
address the server has.
So for example you could use
-- squid.conf --
http_port 80
httpd_accel_host your.main.site
httpd_accel_uses_host_header on
acl backend-servers dst server1 server2
http_access allow backend-servers
-- /etc/hosts --
10.1.1.2 your.main.site server1
10.1.1.3 other.site server2
-- /etc/nsswitch.conf --
hosts: files dns
If you use a redirector then you need to make a simple program (most
people use a small perl script) that rewrites the requests to allow
Squid to forward them to the correct backend server.
A simple and extensible sheme based on a redirector and special DNS
names for the backend servers is like this:
-- squid.conf --
http_port 80
httpd_accel_host virtual
httpd_accel_uses_host_header on
redirect_rewrites_host_header off
redirect_program /usr/local/squid/bin/accel_redirect.pl
-- /usr/local/squid/bin/accel_redirect.pl --
#!/usr/bin/perl
# Rewrites all URLs to the form
http://www.site.com-backend.your.domain...
$|=1;
while(<>) {
s%http://([^/]*)%http://$1-backend.your.domain%
print;
}
-- DNS for your.domain --
www-site.com-backend IN CNAME server1
www-site2.com-backend IN CNAME server2
192.168.1.2-backend IN CNAME server1
(add any further mappings from official internet IP addresses on the
accelerator server to backend servers to support non-virtual domains)
-- Henrik Nordstrom Spare time Squid hackerReceived on Sun Jul 11 1999 - 16:10:17 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:47:20 MST