Sunday, November 23, 2008

Introduction to Squid

Squid is a free open source caching proxy software. Squid binaries for Windows can be downloaded from http://squid.acmeconsulting.it/.

Installing

In this example, squid-2.7.STABLE5-bin.zip is downloaded and extracted. Then "squid" directory was copied into C drive as "C:squid". Then go to "C:squidetc" directory, copy and rename the following files:
squid.conf.default ==> squid.conf
mime.conf.default ==> mime.conf
cachemgr.conf.default ==> cachemgr.conf
You can edit squid.conf as needed. In this example, it was left unchanged.
Open windows start menu and go to Start->Run. And enter "cmd" and click OK to launch "Comman Prompt" windows. Enter
cd C:squidsbin
in the command prompt to go to sbin folder that contains "squid.exe" program. Then enter a command in this format "squid -i [-f configfile] [-n servicename]" to installs the servicename Squid service using the configfile configuration file. (default configfile is "c:/squid/etc/squid.conf", default servicename is "Squid"). Here we used servicename as squid and configfile is at C:squidetcsquid.conf so you don't have to enter optional arguments. Use path with '/' char, NOT '' and you need to enter
squid -i -f c:/squid/etc/squid.conf  -n squid
and then a command to creates the cache directories as follow
squid -z -f c:/squid/etc/squid.conf

After that, enter
squid -O servicecommandline  -n squid

to set in Windows Registry the Squid servicename service command line.
Then open "Start->Control Panel->Administrative Tools->Services" and start "squid" service. Squid proxy server listens to port 3128 by default.

Client Side Setting


In the browser of client machine that wants to use proxy server, proxy settings have to be configured in some way. In this example Mozilla Frefox was used. In the Firefox browser, go to Tools menu -> Options... command -> Network tab -> click Settings... button inside connection frame and enter address of proxy server and port (3128 in this case).

In Linux machines, squid can be used as transparent proxy directly. But in windows machines, it is still a known limitation (Transparent Proxy: missing Windows non commercial interception driver).