Re: [squid-users] cache-peer and hosts file

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 19 Nov 2009 23:43:30 +1300

NublaII Lists wrote:
> Hi there
>
> I have a couple of quick questions to which I have seen many examples,
> but I have never been able to figure out the whole picture.
>
> In a simple setup like this:
>
> 1 squid machine
> 2 www servers
>
> website: www.example.com
> external ip: 1.2.3.4
>
> squid machine:
> name: squid.example.com
> ip: 10.0.0.1
>
> www1 machine:
> name: www1.example.com
> ip: 10.0.0.2
>
> www2 machine:
> name: www2.example.com
> ip: 10.0.0.3
>
> Here is the part of the squid.conf that applies here
>
> # Basic parameters
> visible_hostname www.example.com
> # This line indicates the server we will be proxying for
> http_port 80 accel defaultsite=www.example.com
> # And the IP Address for it
> cache_peer 10.0.0.2 parent 80 0 no-query originserver round-robin
> cache_peer 10.0.0.3 parent 80 0 no-query originserver round-robin
>
> So, questions...
>
> - is the squid.conf syntax correct?

Yes. The syntax is correct.

Whether it does what you want is a matter only you can tell. I'd suggest
some dstdomain ACL (as per the Squid wiki BasicAccelerator configuration
example) to protect your backend servers from garbage attack requests.

> - what should I have on the /etc/hosts file on the squid machine?
> RIght now this is what I have
>
> 127.0.0.1 localhost
> 10.0.0.1 squid.example.com
> 10.0.0.2 www.example.com
> 10.0.0.3 www.example.com

hosts file is not relevant in simple revere-proxy setups. Squid is
passing the requests directly to the peer IP from the configuration
file. DNS is not needed to find the peer IP when its configured.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE7 or 3.0.STABLE20
   Current Beta Squid 3.1.0.14
Received on Thu Nov 19 2009 - 10:43:53 MST

This archive was generated by hypermail 2.2.0 : Thu Nov 19 2009 - 12:00:04 MST