1. The client sends a data request to the proxy server;
/var/log/squid/access.log
4.2squid.conf file configuration
vi /etc/squid/squid.conf make the following configuration
http_port 192.168.252.11:3164 #Listening port (for security reasons, add the IP address in front, Squid will not listen to the external network interface)
cache_dir ufs /var/spool/squid 100 16 256 //Define Squid's cache storage path. The cache directory capacity is 100M. There are 16 first-level cache directories and 256 second-level cache directories.
--Must be at the end of the configuration file Add the following statement below, otherwise Squid cannot start!
visible_hostname localhost
--Configure some ip addresses to be accessible
acl normal src 192.168.101.1-192.168.101.250/32
http_access allow normal
#cache access_log /var/log/squid/access.log Set the access log file
#cache store_log /var/log/squid/store.log Set the web cache Log file
#cache effective user/group squid
5. Start
--Create cache directory
cd /usr/sbin/squid
./squid -z
2017/06/30 15:13:54| Creating Swap Directories
2017/06/30 15:13:54| /var/spool/squid exists
2017/06/30 15:13:54| Making directories in /var/spool/squid/00
2017/06/30 15:13:54| Making directories in /var/spool/squid/01
2017/06/30 15:13:54| Making directories in /var/ spool/squid/02
2017/06/30 15:13:54| Making directories in /var/spool/squid/03
2017/06/30 15:13:54| Making directories in /var/spool/squid/04
2017/06/30 15:13:54| Making directories in /var/spool/squid/05
2017/06/30 15:13:54| Making directories in /var/spool/squid/06
2017/06/30 15:13:54| Making directories in /var/spool/squid/07
2017/06/30 15:13:54| Making directories in /var/spool/squid/08
2017/06/30 15:13:54| Making directories in /var/spool/squid/ 09
2017/06/30 15:13:54| Making directories in /var/spool/squid/0A
2017/06/30 15:13:54| Making directories in /var/spool/squid/0B
2017/06/30 15:13:54| Making directories in /var/spool/ squid/0C
2017/06/30 15:13:54| Making directories in /var/spool/squid/0D
2017/06/30 15:13:54| in /var/spool/squid/0E
2017/06/30 15:13:54| Making directories in /var/spool/squid/0F
iptables Corresponding configuration
If it is a normal proxy, you need to configure the NAT table of iptables, and forward access to port 80 to the squid port
iptables -t nat -A PREROUTING -s specify the ip segment- p tcp --dport 80 -j REDIRECT --to-port 3164
If it is a non-transparent proxy, you need to develop the Squid port
iptables -A INPUT - s specifies the ip segment -p tcp --dport 3164 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 3164 -j ACCEP