Simple configuration of Squid proxy and reverse proxy

Source: Internet
Author: User
Tags squid proxy

Squid cache (Squid for short) is a popular free software that complies with the GNU General Public License. As the front cache server of the web server, Squid can request data from the web server and cache data. It can also be used in the LAN to allow LAN users to access the Internet through proxy. Squid is designed to run in a Linux system.

1. squid Proxy:

Yum install squid # install squid3.x

Vi/etc/squid. conf
Add the following (pay attention to the order, as far as possible at the top)
Acl localnet src 192.168.1.0/32 # define your source CIDR block or IP address
Acl dst_net dst 8.8.8.8 www.bkjia.com # defines the target IP address, domain name, and CIDR block that the proxy can access.

Http_access allow localnet # allow the source defined by localnet to be accessed through a proxy

Http_access deny! Dst_net # Access Denied is not the target address defined by dst_net, that is, access to dst_net only
# Http_port = 3128 default listening port 3128,
# Http_access rejects all items by default. That is, if no item is matched, the request is rejected.
Then set the proxy IP address and port in your customer IE, such:

Xxxxxx


2. squid reverse proxy:

Vi/etc/squid. conf

Add acl and http_access to allow all access

Set the listening port 80 in http_port = 80, and then add

Cache_peer 192.168.1.156 parent 8000 0 name = a # set multiple backend IP addresses and ports, and add one line

Cache_peer_domain a www.bkjia.com # multiple domain names are separated by Spaces
The following error occurs:

ERROR

The requested URL cocould not be retrieved

--------------------------------------------------------------------------------


The following error was encountered while trying to retrieve the URL :/


Invalid URL

Some aspect of the requested URL is incorrect.

Some possible problems are:

Missing or incorrect access protocol (shocould be "http: //" or similar)


Missing hostname


Illegal double-escape in the URL-Path


Illegal character in hostname; underscores are not allowed.


Your cache administrator is root.

If the preceding error occurs, modify the following:


Http_port 80 defaultsite = www.bkjia.com

Cache_peer 192.168.1.156 parent 8000 0 no-query originserver weight = 1 name =

Cache_peer_domain a www.bkjia.com

 

Or: (recommended)

Http_port 80 transparent

Cache_peer 192.168.1.156 parent 8000 0 no-query originserver name =

Cache_peer 192.168.1.144 parent 80 0 no-query originserver name = B

Cache_peer_domain a www.bkjia.com

Cache_peer_domain B www.bkjia.net

Then the access is normal again.

2. Reverse Proxy
Access Denied Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.
To solve this problem, cancel the proxy on the client, that is, do not use any proxy.

Squid details: click here
Squid: click here

Recommended reading:

Configure Squid proxy http and rsync

Squid: high-speed Web Access

CentOS 6.2 compilation and installation Squid configuration Reverse Proxy Server

Application of Squid in Enterprise Network

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.