Enabling the Squid Cache Manager

Squid cache logo

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.

  1. Connect to your NAS as root
  2. vi /opt/etc/squid/squid.conf
  3. Find the line with this text http_access allow manager localhost and add http_access allow manager localnet just below. This will grant access to the cache-manager to your whole LAN.
  4. Restart Squid: /opt/etc/init.d/S80squid restart.
  5. Logout of your NAS.
  6. On your mac, install Squid sudo port install squid @2.7
  7. Go to your CGI bin directory pushd /Library/WebServer/CGI-Executables
  8. Install the cgi clientsudo ln /opt/local/libexec/squid/cachemgr.cgi ./
  9. Edit the configuration file of said tool sudo vi /opt/local/etc/squid/cachemgr.conf
  10. Replace localhost with the hostname/address of your NAS.
  11. Point a web browser to the address
  12. The web-UI will ask for some name/password pair, give any random thing
  13. You should see a web UI to Squid.

2 thoughts on “Enabling the Squid Cache Manager”

  1. And did find any effectiveness?

    In a personal environment, I don’t see the point for a proxy, except in one case: filtering proxy with parental control for children.

  2. With the default settings, the cache hit rate is 13%, nothing exceptional, but still a win, in particular for my phone at home. I think I could improve this by overriding the TTL of the static content provider and tracker sites.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.