Could not determine this machines public hostname. Please configure one or set 'visible_hostname'. - Squid

Could not determine this machines public hostname. Please configure one or set ‘visible_hostname’. – Squid

During the startup sequence of Squid you may encounter the following Warning:

Stopping squid: 2013/12/13 03:42:05| WARNING: Could not determine this machines public hostname. Please configure one or set ‘visible_hostname’.

This is caused because squid is unable to work out what your hostname is, it will attempt to do a reverse IP lookup on it too, so if your DNS changes have not fully had a chance to propogate yet, this could also be the cause of the warning.

The simplest solution is to manually set the hostname in the squid.conf file and then squid will have no reason to work it out for itself.

To do this open your squid.conf file:

nano /etc/squid/squid.conf

and add or update this line to your configuration file:

visible_hostname [your hostname for squid]

Where you see [your hostname for squid] you should replace it with the hostname of your machine (for example: mysquidserver.com)

When you have done this, save your changes and then execute the following command to restart squid:

service squid restart

In a few moments you should see that squid has come back online again, and there should be no more warning message about the hostname.