How to set up Squid Cache

  

Squid proxy server General Unix, Linux comes with it. I am using CentOS 5.3, and Squid is self-compiled.

Squid Default cache_mem 100 16 256

Open /etc/squid/squid.conf

Configuration

$vi /etc/squid/squid.conf

#http_port is the port of the proxy. If no other http service occupies port 80 or 8080, you can configure these two ports, which is easy to remember. I am equipped with 8086. The default port is 3128

http_port 8086

#Set the cache memory size to 1G, my server memory is 2G.

cache_mem 1000 MB

#Set the cache_dir address, the first numeric parameter can't be smaller than the size set by cache_mem, otherwise it will warn “WARNING cache_mem is larger than total disk cache space!” , so set to 1000. 16, 256 represents the first level and second level directory. After setting up, you need to use squid -z to make the cache directory take effect.

cache_dir ufs /var/spool/squid 1000 16 256

#Settings allow everyone to access. By default, no one is allowed to use the proxy. Error: "The requested URL could not be retrieved while trying to retrieve the URL: ...”

http_access allow all

#Set visible_hostname, otherwise an error will be reported: <;FATAL: Could not determine fully qualified hostname. ” Please set 'visible_hostname'

visible_hostname zhhproxy

#Others are saved with default values.

$squid -z

Creating Swap Directories

$squid -NCd1

Running in the foreground for easy debugging. Debugging is done directly by executing Squid to run it as a sprite process.

See the print Ready to serve requests. It's ready.

Copyright © Windows knowledge All Rights Reserved