There are no hard-and-fast rules. The most important resource for Squid is physical memory. Your processor does not need to be ultra-fast. Your disk system will be the major bottleneck, so fast disks are important for high-volume caches. Do not use IDE disks if you can help it.
In late 1998, if you are buying a new machine for a cache, I would recommend the following configuration:
Also, see Squid Sizing for Intel Platforms by Martin Hamilton This is a very nice page summarizing system configurations people are using for large Squid caches.
After compiling Squid, you can install it with this simple command:
% make installIf you have enabled the ICMP features then you will also want to type
% su # make install-pinger
After installing, you will want to edit and customize the squid.conf file. By default, this file is located at /usr/local/squid/etc/squid.conf.
Also, a QUICKSTART guide has been included with the source distribution. Please see the directory where you unpacked the source archive.
The squid.conf file defines the configuration for squid. the configuration includes (but not limited to) HTTP port number, the ICP request port number, incoming and outgoing requests, information about firewall access, and various timeout information.
Yes, after you make install
, a sample squid.conf file will
exist in the ``etc" directory under the Squid installation directory.
The sample squid.conf file contains comments explaining each option.
After you've finished editing the configuration file, you can start Squid for the first time. The source distribution includes a script called RunCache which makes sure the Squid process is always running.
With version 1.1.16 and later, you must first run Squid with the -z option to create the cache swap directories.
% /usr/local/squid/bin/squid -zSquid will exit when it finishes creating all of the directories. Next you can start RunCache:
% /usr/local/squid/bin/RunCache &
For versions before 1.1.6 you should just start RunCache immediately, instead of running squid -z first.
On systems which have an /etc/inittab file (Digital Unix, Solaris, IRIX, HP-UX, Linux), you can add a line like this:
sq:3:respawn:/usr/local/squid/bin/squid.sh < /dev/null >> /tmp/squid.log 2>&1We recommend using a squid.sh shell script, but you could instead call Squid directly. A sameple squid.sh script is shown below:
#!/bin/sh C=/usr/local/squid PATH=/usr/bin:$C/bin TZ=PST8PDT export PATH TZ notify="root" cd $C umask 022 sleep 10 while [ -f /tmp/nosquid ]; do sleep 1 done /usr/bin/tail -20 $C/logs/cache.log \ | Mail -s "Squid restart on `hostname` at `date`" $notify exec bin/squid -CYs
On BSD-ish systems, you will need to start Squid from the ``rc'' files, usually /etc/rc.local. For example:
if [ -f /usr/local/squid/bin/RunCache ]; then echo -n ' Squid' (/usr/local/squid/bin/RunCache &) fi
Some people may want to use the ``init.d'' startup system. If you start Squid (or RunCache) from an ``init.d'' script, then you should probably use nohup, e.g.:
nohup squid -sY $conf >> $logdir/squid.out 2>&1Also, you may need to add a line to trap certain signals and prevent them from being sent to the Squid process. Add this line at the top of your script:
trap '' 1 2 3 18
You can use the client program:
% client http://www.netscape.com/ > test
There are other command-line HTTP client programs available as well. Two that you may find useful are wget and echoping.
Another way is to use Squid itself to see if it can signal a running Squid process:
% squid -k checkAnd then check the shell's exit status variable.
Also, check the log files, most importantly the access.log and cache.log files.
These are the command line options for Squid-2:
Specify an alternate port number for incoming HTTP requests. Useful for testing a configuration file on a non-standard port.
Debugging level for ``stderr'' messages. If you use this option, then debugging messages up to the specified level will also be written to stderr.
Specify an alternate squid.conf file instead of the pathname compiled into the executable.
Prints the usage and help message.
Sends a HUP signal, which causes Squid to re-read its configuration files.
Sends an USR1 signal, which causes Squid to rotate its log files. Note, if logfile_rotate is set to zero, Squid still closes and re-opens all log files.
Sends a TERM signal, which causes Squid to wait briefly for current connections to finish and then exit. The amount of time to wait is specified with shutdown_lifetime.
Sends an INT signal, which causes Squid to shutdown immediately, without waiting for current connections.
Sends a KILL signal, which causes the Squid process to exit immediately, without closing any connections or log files. Use this only as a last resort.
Sends an USR2 signal, which causes Squid to generate full debugging messages until the next USR2 signal is recieved. Obviously very useful for debugging problems.
Sends a ``ZERO'' signal to the Squid process. This simply checks whether or not the process is actually running.
Send debugging (level 0 only) message to syslog.
Specify an alternate port number for ICP messages. Useful for testing a configuration file on a non-standard port.
Prints the Squid version.
Creates disk swap directories. You must use this option when installing Squid for the first time, or when you add or modify the cache_dir configuration.
Do not make initial DNS tests. Normally, Squid looks up some well-known DNS hostnames to ensure that your DNS name resolution service is working properly.
If the swap.state logs are clean, then the cache is rebuilt in the ``foreground'' before any requests are served. This will decrease the time required to rebuild the cache, but HTTP requests will not be satisified during this time.
Do not automatically become a background daemon process.
Do not set the SO_REUSEADDR option on sockets.
Enable virtual host support for the httpd-accelerator mode. This is identical to writing httpd_accel_host virtual in the config file.
Enable full debugging while parsing the config file.
Return ICP_OP_MISS_NOFETCH instead of ICP_OP_MISS while the swap.state file is being read. If your cache has mostly child caches which use ICP, this will allow your cache to rebuild faster.