I have Googled, searched StackOverflow and here. Still I can not fully understand what or why someone would use Squid.

All I can find out so far is that it is some sort of cache that can make it less work that your server (i.e. Apache) has to do. So can someone clarify exactly what Squid does and more importantly, why would I want to use Squid?

I have a large social network site so maybe it would benefit for serving images or something, I am currently running lighttpd seperate from Apache, just for serving images.


Squid is a web cache that caches web content, and returns it quickly on request. Handling a request through squid is frequently faster than a general-purpose webserver even for simple files (e.g. images), but it really comes into its own for caching pages that are dynamically generated, which can be expensive and slow. It thus allows you to build your pages dynamically but lets you serve a static, cached copy quickly to requesters. There's a lot of configuration possible about how long it caches for, which pages it caches, and how to invalidate a cached result.

For instance, Wikipedia uses caches (squid and others) as a content accelerator, so that every hit on a page doesn't make it be regenerated from the database through a lot of PHP. When pages are changed, the cache entry is invalidated.


Its opensource and even works with Windows.

I would also like to add that it isnt only a web cache. The squid.conf file has tons of options. We are running it as a webfilter (using free blacklists) and are even using it to block ports on a handful of machines.

  • "Its opensource and even works with Windows." Sure, but how is that relevant to the question of why the poster should consider using it? – John Gardeniers Sep 18 '09 at 2:55
  • On the other hand it's a good point about the other options, so +1 for that. – Maximus Minimus Sep 18 '09 at 8:34
  • JG - I think 'open source' is sometimes reason enough to use certain software over others. – cop1152 Sep 18 '09 at 13:45

Apart from all the answers here, Squid can also be used to filter content provided to the end user. For example you can prevent minors from viewing adult sites.

Squid can also scan downloaded files against viruses.

Yes, it's really powerful.


As Morven pointed out using Squid as Reverse Proxy can speed up page delivery by caching pages that would have to be build dynamically by the web server but change rarely in reality.

Just as an addition as far as I know this is not Squids main purpose and NGINX might by a better solution as it is supposed to be the fastest reverse proxy solution. You might want to look into it as well.


If you want a reverse-proxy to accelerate web traffic by caching images and slow-generating pages, you might want to look at Varnish instead of Squid. It's designed for reverse-proxy behavior, is lightning fast, and fairly simple to set up. Squid is designed as a forward proxy more than a reverse proxy. If you had a large social network site, you might want to consider using a CDN for the images and static content as well. Internet -> CDN -> Varnish -> Apache cluster You can also use Varnish as a load balancer as it can check node health.


I haven't used Squid as a reverse-proxy, I did however use Pount and HAProxy (at the same time) and it was a great system, we used it to enable load balancing and High Availability and didn't use the caching aspect of them.

Let me know if you want more info on the setup.


Squid is commonly used to cache content from the outside world into your companies network.

You wouldn't use it in a hosting or content delivery scenario.

  • 6
    Many people use squid as an accelerator for web sites. Using it on your own network is probably the more common usage. – Zoredache Sep 17 '09 at 23:59
  • Yep, I've used squid as an accelerator for webservers by using its reverse proxying capabilities – Nick Kavadias Sep 18 '09 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.