[Ubuntu] Squid

Created: August 27, 2018 13:28 -
Last Updated: August 29, 2018 13:21

What is Squid?

Squid is a proxy server and web cache daemon. It has a wide variety of uses, from speeding up a web server by caching repeated requests; to caching web, DNS and other computer network lookups for a group of people sharing network resources; to aiding security by filtering traffic. Although primarily used for HTTP and FTP, Squid includes limited support for several other protocols including TLS, SSL, Internet Gopher and HTTPS.

Installing Squid

You can install Squid either by using the package manager of your OS, or by compiling from source.

An accelerator caches incoming requests for outgoing data (i.e., that which you publish to the world). It takes load away from your HTTP server and internal network. You move the server away from port 80 (or whatever your published port is), and substitute the accelerator, which then pulls the HTTP data from the "real" HTTP server (only the accelerator needs to know where the real server is). The outside world sees no difference (apart from an increase in speed, with luck).

How do I set it up?

Their are multiple ways to configure Squid as a Reverse proxy of Website Accelerator, below is a configuration for a basic setup

Configuring a Basic Reverse Proxy (Website Accelerator)

This configuration covers the basic Reverse Proxy (Accelerator) config. More advanced configurations all build on these basic settings. This configuration is designed for two Servers.

The accel option to http_port should only be specified for 2.6.STABLE8 and later.

First, you have to tell Squid to listen on port 80 (usually), so set the http_port option with the defaultsite option telling Squid it's an accelerator for this site:

http_port 80 accel defaultsite=your.main.website.name no-vhost

accel tells Squid to handle requests coming in this port as if it was a Web Server defaultsite=X tells Squid to assume the domain X is wanted. no-vhost for Squid-3.2 or later disables HTTP/1.1 domain based virtual hosting support. Omit this option for older Squid versions.