The reverse proxy configuration process is actually not much different from the forward proxy, the only difference is that the configuration file
A place to change. Need to put:
Http_port 3128
Switch
Http_port Accel Vhost Vport
Then add the backend real server information you want to proxy:
Cache_peer 180.97.33.108 Parent 0 originserver Name=a
Cache_peer 101.226.103.106 Parent 0 originserver Name=b
Cache_peer_domain a www.qq.com
Cache_peer_domain b www.baidu.com
Because we did not configure the site information before, so take qq.com and baidu.com to do an example. which
Cache_peer to configure the backend server IP as well as the port, name behind the domain name to configure, here and behind the
Cache_peer_domain corresponds. In real-world applications, IP is mostly internal and external IP, and domain names may have multiple, if
It's squid. To proxy all domain names on a Web, write this:
Cache_peer 192.168.10.111 Parent 0 Originserver
The back even Cache_peer_domain was saved.
Reverse proxies are primarily used to cache static items, because many static items, especially pictures, streaming media, and so on are more bandwidth-consuming,
In China, Unicom network access to telecommunications resources in this case is slow, if you go to visit the large flow of pictures, streaming media that will be slower,
So if you configure a SQUID reverse proxy in the Unicom network, let the Unicom client directly access this Unicom squid, and this
Some static items have been slow to exist on Squid, which greatly accelerates the access speed. Maybe you've heard of CDN, in fact
The principle of its design is such a way of thinking. OK, let's test the reverse proxy again.
Because the configuration file has been modified, you need to restart Squid:
#/etc/init.d/squid Restart
# curl-xlocalhost:80 http://www.baidu.com/
# curl-xlocalhost:80 http://www.qq.com/
# curl-xlocalhost:80 http://www.sina.com/
You will find that both baidu.com and qq.com are able to access normally, but sina.com access 503, which is because I
We do not have the relevant settings for adding sina.com.
Note: Because only one IP and domain name is bound, and the reverse proxy server is also referred to in host. So you can access it. But other domain names such as: Teiba.baidu.com is not configured in the configuration, and also no more specified in the host, so access is the real address, not through the proxy, can be accessed. If the host specifies that no configuration is configured in the configuration, it is not necessary to go through the proxy.
2.2-SQUID Reverse Proxy