Re: http_accel, virtual hosts, and logging.

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sun, 02 Apr 2000 15:39:23 +0200

Greg Retkowski wrote:

> several virtual hosts. My problem is that my configuration generates URL
> logs like:
>
> 954291569.255 85 128.209.24.253 TCP_MISS/200 3250 GET
> http://localhost/ldap/ - DIRECT/localhost text/html
>
> However I need something like:
>
> 954291569.255 85 128.209.24.253 TCP_MISS/200 3250 GET
> http://www.rage.net/ldap/ - DIRECT/localhost text/html
>
> so that I can account for which virtual sites are recieving the traffic.

You also need it to not mess up the virtual hosts. What is logged is
what Squid requests from your web server.

> My guess is that the 'httpd_accel_uses_host_header on' setting tells squid
> to attempt to directly connect to the site as resolved through DNS, rather
> than connecting to localhost.

True, but it is also needed for Squid to distinguish between the
different sites. Else all will be handled as one single site (only
looking at the request path, not the host component).

There are ways around this. The one I commonly recommend is to use the
local hosts file for name resulotion for Squid.

Edit /etc/nsswitch.conf to read

hosts: files dns

Then change squid.conf to
httpd_accel_host your.main.site
httpd_acces_uses_host_header on

And edit /etc/hosts to include mappings of all the server domains to
127.0.0.1.

I also have a patch to simplify this by forcing httpd_accel_host to be
used on accelerated requests. See httpd_accel_single_host on
http://squid.sourceforge.net/hno/patch-devel.html

--
Henrik Nordstrom
Squid hacker
Received on Mon Apr 03 2000 - 09:27:59 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:52:38 MST