Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Squid Proxy Server 3.1: Beginner's Guide

You're reading from   Squid Proxy Server 3.1: Beginner's Guide Reduce bandwidth use and deliver your most frequently requested web pages more quickly with Squid Proxy Server. This guide will introduce you to the fundamentals of the caching system and help you get the most from Squid.

Arrow left icon
Product type Paperback
Published in Feb 2011
Publisher Packt
ISBN-13 9781849513906
Length 332 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Toc

Table of Contents (20) Chapters Close

Squid Proxy Server 3.1 Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with Squid 2. Configuring Squid FREE CHAPTER 3. Running Squid 4. Getting Started with Squid's Powerful ACLs and Access Rules 5. Understanding Log Files and Log Formats 6. Managing Squid and Monitoring Traffic 7. Protecting your Squid Proxy Server with Authentication 8. Building a Hierarchy of Squid Caches 9. Squid in Reverse Proxy Mode 10. Squid in Intercept Mode 11. Writing URL Redirectors and Rewriters 12. Troubleshooting Squid Pop Quiz Answers Index

Time for action – exploring Squid files


Let's have a look at the files and directories generated during installation. The easiest way to checkout the directories and files generated is to use the tree command. If the tree command is not available, we can list files using the ls command as well.

tree ${prefix} | less

${prefix} is the directory used with the --prefix option for configure. Now let's have a brief overview at the important files generated by Squid during installation. All of the following directories and files listed, reside in ${prefix}:

bin

This directory contains programs which can be executed or run by a user without root or super user privileges.

bin/squidclient

squidclient is a HTTP client with advanced capabilities, which allow it to tinker HTTP requests to test the Squid server. Run squidclient to checkout the available options:

${prefix}/bin/squidclient

etc

This is the place where for all the configuration files related to Squid are located.

Note

It's a good idea to use the --sysconfdir=/etc/squid/ option with configure, so that you can share the configuration across different Squid installations while testing.

etc/squid.conf

This is the default location for the Squid configuration file. The squid.conf generated during installation is the bare minimum configuration required for Squid to be used. We always make changes to this file if we need to alter the Squid configuration.

etc/squid.conf.default

Squid generates this default configuration file so that we can copy and rename it to squid.conf and start afresh.

etc/squid.conf.documented

This is a fully documented version of squid.conf, containing thousands of lines of comments. We should always refer to this file for the available configuration tags for the version of Squid when we have installed.

libexec

This directory contains helper programs built during Squid compilation.

libexec/cachemgr.cgi

This CGI program provides a web interface for managing the Squid cache called Cache Manager.

sbin

This directory contains programs which can only be executed by a user with root or super user privileges.

sbin/squid

This is the actual Squid program, which is generally run as a daemon.

share

This is the location for error page templates, documentation, and other files used by Squid.

share/errors

This directory contains localized error page templates. The templates are HTML pages and we can customize the error messages displayed by Squid, by modifying these HTML templates.

share/icons

This directory contains a number of small images used for FTP or gopher directory listing.

share/man

This is the place where the man pages for squid, squidclient, and helpers are built during compilation. Man pages are manual or help pages which can be viewed using the command man (available on all Linux/Unix distributions). To view a man page located at /opt/squid/share/man/man8/squid.8, we can use the man command as follows:

man /opt/squid/share/man/man8/squid.8

For more details about man pages, please visit http://en.wikipedia.org/wiki/Man_page.

var

A place for files that change frequently while Squid is running.

var/cache

This is the default directory for storing the cached web documents on a hard disk.

var/logs

This is the default home for all the log files (such as cache.log, access.log, and so on) used by Squid.

What just happened?

We have just looked at the various files and directories generated during installation and a had brief overview of what each directory contains.

Installing Squid from binary packages

Squid binary packages are available in the software repositories of most operating systems and we can install them by using the package managers provided by the respective operating systems. Next, we'll see how to use a package manager on a few operating systems to install Squid.

Note

The latest or beta versions may not be available in software repositories of all the operating systems. In such cases, we should get the latest or beta versions from the Squid website, as explained earlier in this chapter.

Fedora, CentOS or Red Hat

Yum is a popular package manager on RPM-based operating systems. Squid RPM is available in the Fedora, CentOS, and Red Hat repositories. To install Squid, we can simply use the following command:

yum install squid

Debian or Ubuntu

We can use apt-get to install Squid on Debian or Ubuntu:

apt-get install squid3

FreeBSD

Squid is available in the FreeBSD ports collection. The following command can be used to install Squid on FreeBSD:

pkg_add -r squid31

For more information on package management in FreeBSD, please go to http://www.freebsd.org/doc/handbook/packages-using.html.

OpenBSD or NetBSD

Installing Squid on OpenBSD or NetBSD is similar to installing it on FreeBSD and can be performed using the following command:

pkd_add squid31

To learn more about the package management system in OpenBSD and NetBSD, please refer to http://www.openbsd.org/ports.html#Get and http://www.netbsd.org/docs/pkgsrc/using.html#installing-binary-packages respectively.

Dragonfly BSD

To install Squid on Dragonfly BSD, we can use the following command:

pkg_radd squid31

For more information on installing binary packages on Dragonfly BSD, please visit http://www.dragonflybsd.org/docs/newhandbook/pkgsrc/.

Gentoo

We can install Squid on Gentoo Linux using emerge, as shown next:

emerge =squid-3.1*

Arch Linux

To install Squid on Arch Linux, we can use the package manager pacman, as shown in the following command:

pacman -S squid

For more information on pacman, please visit https://wiki.archlinux.org/index.php/Pacman.

Pop quiz

  1. Which of the following web documents can't be cached by a proxy server?

    1. A HTML page

    2. A JPEG image

    3. A PHP script that produces output based on a client's IP Address

    4. A JavaScript file

  2. In which of the following scenarios, should we worry about the --enable-diskio option?

    1. Caching in RAM (main memory) is enabled

    2. Caching on hard disk is enabled

    3. Caching is disabled

    4. None of the above

  3. When does a removal policy selection affect the overall Squid performance?

    1. If caching is disabled

    2. If caching on the hard disk and RAM is enabled

    3. A removal policy selection is not related to caching

    4. A removal policy doesn't affect overall Squid performance

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image