Install and configure Squid3.0 reverse proxy in Linux

Source: Internet
Author: User
Article Title: install and configure Squid3.0 reverse proxy in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In Linux, Squid3.0 and Squid2.X have changed a lot. Here, let's forget:

Squid3.0 is easy to install:

./Configure -- prefix =/usr/local/squid
Make
Make install
Chown-R nobody. nobody/usr/local/squid/var/
/Usr/local/squid/sbin/squid-z

The configurations of Squid3.0 are not complex:

Suppose we have two Apache servers that require reverse proxy: www.avnads.cn (IP: x. x); www.britepic.org (IP: y. y ).

If your Apache and Squid are on the same server, you should pay attention to the port problem. Apache can use non-80 ports, while Squid uses port 80, apache and Squid can also use port 80, but Apache uses the loop address while Squid uses the Internet address. In this case, Apache httpd. set Listen 127.0.0.1: 80 in conf.

The squid. conf file contains more than four thousand lines, but most of them are comments. configuring the reverse proxy function involves the following items:

Acl

Find the location of TAG: acl in the file, and add our settings to it:

Acl sites dstdomain .avnads.cn
Acl sites dstdomain .britepic.org

Http_access

Find the location of TAG: http_access in the file, followed by a line of comment:

# Insert your own rule (S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

We put the custom rules below this line:

Http_access allow sites

The location of http_access is very important. The following settings are available:

# And finally deny all other access to this proxy
Http_access deny all

It rejects all the remaining access.

Http_port

Find the location of TAG: http_port in the file, and add our settings to it:

Http_port 80 defaultsite = default site vhost

Generally, vhost is enough, but defaultsite is good. After all, some HTTP1.0 clients do not send the Host Header. In this case, the system has a default value which is always better than no.

Cache_peer

Find the location of TAG: cache_peer in the file, and add our settings to it:

Cache_peer x. x parent 80 0 no-query originserver name = foo
Cache_peer y. y parent 80 0 no-query originserver name = bar

Cache_peer_domain

Find the location of TAG: cache_peer_domain in the file, and add our settings to it:

Cache_peer_domain foo www.avnads.cn
Cache_peer_domain bar www.britepic.org

Cache_peer_access

Find the location of TAG: cache_peer_access in the file, and add our settings to it:

Cache_peer_access foo allow sites
Cache_peer_access bar allow sites

 

Related Article

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.