Squid_ The Definitive Guide - Duane Wessels [29]
Squid may be unable to determine its fully qualified hostname for a number of reasons, including:
The hostname may not be set.
The hostname may be missing from the DNS zone or /etc/hosts files.
The Squid system's DNS client configuration may be incorrect or missing. On Unix, you should check the /etc/resolv.conf and /etc/host.conf files.
If you see the fatal message mentioned previously, you need either to fix the hostname and DNS information or explicitly configure the hostname for Squid. In most cases, it is sufficient to ensure the hostname command returns a fully qualified hostname and add an entry to /etc/hosts. If that doesn't work, just set the visible hostname in squid.conf:
visible_hostname squid.packet-pushers.net
Administrative Contact Information
You should set the cache_mgr directive as a favor to your users. The value is an email address users can write to in case a problem surfaces. The cache_mgr address appears in Squid's error messages by default. For example:
cache_mgr squid@web-cache.net
Next Steps
After creating the minimal configuration file, you're more or less ready to run Squid for the first time. To do that, just follow the instructions in the next chapter.
When you've mastered starting and stopping Squid, you can spend some time beefing up the configuration file. You may want to add more sophisticated access controls, which you'll find documented in Chapter 6. Since I didn't say anything about the disk cache yet, you should also spend a fair amount of time in Chapter 7 and Chapter 8.
Exercises
Parse Squid's configuration file with squid -k parse and check the process exit status.
Intentionally introduce a some errors into the configuration file and run squid -k parse again. Notice how Squid reports different errors.
Insert comments into the configuration file. Can you start a comment anywhere, even after a valid directive?
Why do you think some configuration file errors are fatal, but others are not?
Chapter 5. Running Squid
Now that you have Squid installed, and maybe even configured, you need to learn the ins and outs of running Squid. Although most of the configuration occurs in squid.conf, you may find some of Squid's command-line options useful. For example, one of the first things you must do is use the -z option to initialize the cache directories. You may also find the -d option useful for debugging.
Squid normally runs as a daemon process. If you are new to Squid, however, I recommend running Squid in the foreground from a terminal window until you are confident that it is working properly. Following that, you can run Squid as a daemon, in the background. Most likely, you'll want to start Squid each time your system boots. Different operating systems have different approaches to startup scripts. I'll show you how to make it happen in three different ways.
You can send signals to the running Squid process to execute various tasks, such as halting and reconfiguring Squid, and rotating the log files. Although you can use the kill command to send signals, it is easier to use the squid -k commands.
Squid Command-Line Options
Before getting too far into other things, let's look at Squid's command-line options. Many of these you will never use and some are useful only when debugging problems:
-a port
Specifies a new http_port value. This option always overrides the value from squid.conf. Note, however, that you can specify multiple values in squid.conf. The -a option overrides only the first value from the config file. (This option uses the letter "a" because in the Harvest cache, the HTTP port was called the ASCII port.)
-d level
Makes Squid write