12.07.2015 Views

download

download

download

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13Luckily, Squid is available in FreeBSD ports tree and is ported very well to integrateinto the system, and work in conjunction with FreeBSD firewall packages such as pfand ipfw, where needed.Squid can be installed from the /usr/ports/www/squid port directory, and shouldbe activated in the rc.conf file by adding the following variable to the file:squid_enable="YES"Squid requires a little bit of configuration before we actually start its service. First ofall you should specify a few things, such as the location of the cache directory (wherethe cache objects will be stored), its size, and the number of directories. You shouldalso specify a few restriction rules such as the IP address of the clients, in order torestrict web proxy access (unless you want to run a public proxy server).Squid configuration file can be found under the /usr/local/etc/squid/ directorycalled squid.conf.Squid has a large and complicated configuration file with too manyoptions which you may want to tweak. However, the configuration file isfull of samples and explanations on how to use each setting options.To configure the cache directory, find the cache_dir directive and modify it withyour desired configuration. The default cache_dir directive looks like this:cache_dir ufs /usr/local/squid/cache 100 16 256The cache_dir store type specified in the above example is ufs, which is the defaultstorage scheme. The other store types are aufs and diskd. The aufs store type is anasynchronous/multi-threaded ufs scheme. And diskd is the same as ufs, except forthe fact that it is forked as one or more separate processes, to avoid blocking of thesquid process in disk access.The second parameter is the location of the cache directory. This is where the cachedobjects are being stored. You may want to use a separate physical disk for this,depending on the load.The next parameter to consider, after the directory location, is the cache directory.Its maximum size is set to 100 megabytes by this configuration. Make sure youhave enough storage, before increasing this number to a bigger value as your cachedirectory may increase very quickly, and fill up your disk space. Increasing the cachedirectory size should be done with care. Larger cache disk space does not alwaysmean better performance, as this may have a huge overhead on your disk.[ 231 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!