Squid Service Setup

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.