Tuesday, January 29, 2008

Configuring Squid on Ubuntu

Squid is a proxy server for http traffic. It caches all http contents into the local disk. If you open any web page from the internet, squid will check its cache for the copy, if its there and still valid, then you will be given the copy instead. So the browsing experience will be improving, web pages will open much faster...

I tried to install Squid in my laptop (Lenovo T60 running Ubuntu 7.04) to speed up internet browsing experience...

Squid Installation
Installing squid is easy in Ubuntu.

# Install Squid as super user

sudo su
apt-get install squid

# Edit Squid Configuration, fill in the hostname (mine is "thartono-laptop") so :
vi /etc/squid/squid.conf
visible_hostname thartono-laptop

# Close & save, add user for squid, and start it

adduser squid
/etc/init.d/squid start
exit


Don't forget to configure manual proxy in Firefox --> http proxy : 127.0.0.1 port 3128 (as stated in the /etc/squid/squid.conf)

Debugging Commands

Check the squid by opening any web page. If they are opened, then Squid is working OK.

Check the squid by opening 127.0.0.1:3128, the squid will report an error (you could see it that the error messages is generated by Squid from the bottom of the page).

If something does not work right, we could debug it :

#Stop the squid before start debugging
/etc/init.d/squid stop

# Start squid in debug mode
squid -z

# Monitor squid in debug mode
squid -NCd10

#Try to open some web pages, see the terminal for any messages. If you're satisfied, ^C and start squid in normal mode :
/etc/init.d/squid start

1 comment:

Anonymous said...

untuk memaksimakan performance squid,
squid.conf nya perlu dilakukan tweaks terlebih dahulu
bytheway, nice blog