CentOS6.6 compile and install Squid to configure the Reverse Proxy Server

Source: Internet
Author: User

CentOS6.6 compile and install Squid to configure the Reverse Proxy Server

Squid installation:

1. Download the squid source code installation package

Wget http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.3.tar.gz

Extract

Tar zxvf squid-3.2.3.tar.gz

Enter the decompressed directory

Cd squid-3.2.3 (directory location varies according to individual settings)

Install

[Root @ localhost squid-3.2.3] #. /configure -- prefix =/usr/local/squid -- enable-gnuregex -- enable-icmp -- enable-linux-netfilter -- enable-default-err-language = "Simplify_Chinese" -- enable- kill-parent-hack -- enable-cache-digests -- enable-dlmalloc -- enable-poll -- enable-async-io = 240 -- enable-delay-pools -- with-filedescriptors = 65536 -- enable-snmp -- enable-arp-acl -- mandir =/usr/share/man/-- with-large-files

[Root @ localhost squid-3.2.3] # make & make install

If you are using the minimal installation of the centos system, you may not have installed the C language compiler. You need to install it manually. For example, the following error occurs during installation:

-Bash: make: command not found

This is because the compiler is not installed. Run the following command to install it:

Yum install gcc *; yum-y install gcc -*

After installation, make again. So far, squid is installed on the server, and then configure the reverse proxy.

Squid reverse proxy configuration:

This is the configuration I used.

Http_port 80 vhost vport

Cache_mem 256 MB

Maximum_object_size_in_memory 2048 KB

Memory_replacement_policy lru

Cache_dir ufs/var/spool/squid 20480 16 256

Access_log/var/log/squid/access. log

Cache_log/var/log/squid/cache. log

Max_open_disk_fds 0

Minimum_object_size 0 KB

Maximum_object_size 32768 KB

# Logformat combined %> a % ui % un [% tl] "% rm % ru HTTP/% rv" % Hs % <st "% {Referer}> h" "% {user-Agent}> h "% Ss: % Sh

Cache_peer 125.39.127.22 parent 80 0 no-query no-digest originserver name = 88181

# You can add multiple source WEB servers that require reverse proxy. If there is only one source WEB server, no name is available.

Cache_peer 118.144.78.54 parent 80 0 no-query no-digest originserver name = jj

# You can add multiple source WEB servers that require reverse proxy

Cache_peer_domain 88181 88181.com

# If there is only one source WEB server, no cache_peer_domain is available

Cache_peer_domain jj www.linuxidc.com

Http_access allow all

Cache_inclutive_user nobody

Cache_inclutive_group nobody

Cache_mgr zifu.199s0@163.com

# Refresh_pattern ^ ftp: 60 20% 10080

# Refresh_pattern ^ gopher: 60 0% 1440

# Refresh_pattern ^ gopher: 60 0% 1440

# Refresh _pattern. 0 20% 1440

Refresh_pattern-I \. css $360 50% 2880

Refresh_pattern-I \. js $1440 50% 2880

Refresh_pattern-I \. html $720 50% 1440

Refresh_pattern-I \. jpg $1440 90% 2880

Refresh_pattern-I \. gif $1440 90% 2880

Refresh_pattern-I \. swf $1440 90% 2880

Refresh_pattern-I \. jpg $1440 50% 2880

Refresh_pattern-I \. png $1440 50% 2880

Refresh_pattern-I \. bmp $1440 50% 2880

Refresh_pattern-I \. doc $1440 50% 2880

Refresh_pattern-I \. ppt $1440 50% 2880

Refresh_pattern-I \. xls $1440 50% 2880

Refresh_pattern-I \. pdf $1440 50% 2880

Refresh_pattern-I \. rar $1440 50% 2880

Refresh_pattern-I \. zip $1440 50% 2880

Refresh_pattern-I \. txt $1440 50% 2880

**************************************** **************************************** ****************************

Chmod 777/usr/local/squid/var

Chmod 777/usr/local/squid/var/logs

/Usr/local/squid/sbin/squid-z

/Usr/local/squid/sbin/squid-k parse test configuration file

/Usr/local/squid/sbin/squid-k reconfigure reconfiguration File

/Usr/local/squid/sbin/squid-k shutdown close squid

/Usr/local/squid/sbin/squid-s Enable squid background

/Usr/local/squid/sbin/squid-N-d1 front-end start squid

/Usr/local/squid/sbin/squid-k interrupt close squid (higher priority, directly close squid)

/Usr/local/squid/sbin/squid-k kill close squid (highest priority, directly killing squid process)

Set squid auto-start

Echo "/usr/local/squid/sbin/squid-s">/etc/rc. local

Set to automatically scroll logs every Tuesday 02:25.

Echo "25 2 ** 2 root/usr/local/squid/sbin/squid-k rotate">/etc/crontab

Set squid auto-start

/Etc/rc. local

/Usr/local/squid/sbin/squid

So far, the configuration is complete.
Original article: http://wangsheng1.blog.51cto.com/29473/1598799

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.