First, installation
Yum-y Install Squid
Main program: /usr/sbin/squid
configuration directory:
Master files:
Monitor TCP Port number: 3128
Default Access log file: /var/log/squid/access.log
Second, the configuration
1, vi/etc/squid/squid.conf
Find http_access deny all, comment it out
Added at the end:
Http_access Allow all
cache_mem mb # cache memory size
< Span style= "padding:0px;margin:0px;" lang= "en-us" xml:lang= "en-us" > Span style= "padding:0px;margin:0px;font-size:medium;" > maximum_object_size 4096 Kb #
< Span style= "padding:0px;margin:0px;" lang= "en-us" xml:lang= "en-us" > Span style= "padding:0px;margin:0px;font-size:medium;" > Reply_body_max_size 1024000 allow All limit download file size
access_log/var/log/squid/access.log # access log stored files
visible_hostname proxy.test.xom # Your host name
Cache_dir Ufs/var/spool/squid
USF: storage format for cached data
/var/spool/squid Cache Directory
: The cache directory occupies disk space ( M )
- : Number of cache space first-level subdirectories
: Cache space Level Two subdirectory number
2, before the first start to create a cache directory use, command
Squid-z
3. Start Squid
Service Squid restart
Chkconfig squid on
4. Add a forwarding Rule
A. Turn on route forwarding
Echo 1 >/proc/sys/net/ipv4/ip_forward
or Sysctl-w net.ipv4.ip_forward=1
B. Adding firewall rules
REDIRECT 80-port requests to 3128, that is, when connecting to a proxy server, port 80 or 3128 can be connected to the Internet
Iptables-t nat-i prerouting-p tcp--dport 80-j REDIRECT--to 3128
Specify IP to respond to customer requests
Iptables-t nat-a postrouting-j SNAT--to 154.87.60.210
Service Iptables Save
5. Testing
Open the proxy in the browser, fill in the proxy IP and port, access Google
Http://www.ziyouganjue.com
This article is from the "Feel Free" blog, be sure to keep this source http://zalinux.blog.51cto.com/7187986/1629618
Squid Service Setup