Enabling the Squid Cache Manager
I have had a squid proxy running on my NAS for ages, but I was never really able to quantify the effectiveness of the cache. There are a lot of small scripts that parse the squid logs and output some statics, but that is not very satisfactory. Today I realised that Squid offers some kind of web UI to visualise the state of the cache manager.
The squid cache manager is basically two parts, one part that runs on the squid proxy itself, and
cgi-bin program that can be run on any web-server. As I did not see the point in starting a web server on my NAS just for that, I decided to run the
cgi program on my laptop. Here are the steps to get this running. This assumes you know how to use vi and have ports installed on your Mac.
- Connect to your NAS as root
- Find the line with this text
http_access allow manager localhostand add
http_access allow manager localnetjust below. This will grant access to the cache-manager to your whole LAN.
- Restart Squid:
- Logout of your NAS.
- On your mac, install Squid
sudo port install squid @2.7
- Go to your CGI bin directory
- Install the cgi client
sudo ln /opt/local/libexec/squid/cachemgr.cgi ./
- Edit the configuration file of said tool
sudo vi /opt/local/etc/squid/cachemgr.conf
localhostwith the hostname/address of your NAS.
- Point a web browser to the address
- The web-UI will ask for some name/password pair, give any random thing
- You should see a web UI to Squid.