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

From: NublaII Lists <nublaii.lists_at_gmail.com>
Date: Thu, 3 Dec 2009 17:08:44 +0100

Good good... We are already serving almost 80% of our content with
squid, so I guess we're doing something right ;)

One last question, on both machines (10.0.0.2 and 10.0.0.3) do I need
to include an entry to the hosts file responding for the main domain?

Someting like this

127.0.0.1 localhost
10.0.0.2 www.example.com

Tnx again

On Thu, Nov 19, 2009 at 11:43 AM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> 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 Dec 03 2009 - 16:08:57 MST

This archive was generated by hypermail 2.2.0 : Fri Dec 04 2009 - 12:00:01 MST