Time for action – testing our configuration file
As we learned before, we can use the -k parse
option to test our configuration file. Now, we are going to add a test line and see if Squid can catch the error.
For example, let's add the following line to our
squid.conf
file:unknown_directive 1234
Now we'll run Squid with the
-k parse
option as follows:squid -k parse
As
unknown_directive
is not a valid directive for the Squid configuration file, we should get an error similar to the following:2010/07/21 22:28:40| cache_cf.cc(346) squid.conf:945 unrecognized: 'unknown_directive'
So, if we find an error within our configuration file, we can go back and fix the errors and then parse the configuration file again.
What just happened?
We first added an invalid line in to our configuration file and then tried to parse it using a squid
command which resulted in an error. It is a good idea to always parse the configuration file before starting Squid.