First, what is ProxyServer (proxy server), the role of proxy
In the real world we often go to help others do things, such as to help people pay electricity or something, in this case you are not the owner of the meter, but the agent (agents) identity. In the Internet world, Proxy is the equivalent of the people who pay the electricity bill, when we send a connection request, will be through proxy to help us directly with the target server communication, to help us obtain information.
The client uses the ProxyServer to surf the Internet with the following steps:
①client the server to send a request.
②server receives the request to compare to judge the cache in the presence of the client want the information, if not the remote server to send data requests.
③ the requested data into the cache, and then transmits the data to the client side.
④ when the client sends the requested data in the cache, the data in the cache is transmitted directly to the client side.
Although when the first access to the proxy request data cache is not, the proxy crawl data will be saved in the cache, so that the speed of access slows down, but the second visitors and later visitors need the information, proxy do not want to remote server request, The data in the cache is sent directly to the subsequent requester, which reduces the traffic to the remote server, and the transmission is faster because the proxy is local.
Second, the use of squid in the construction of ProxyServer
In this article, the author uses the environment is:
Operating system: Redhat9.0, Kernel: 2.4.20-31.9, other system kits have been updated to the latest via apt.
1. Compile and install Squid
Because squid on the system hardware requirements are relatively high, so we should try to optimize the installation.
CODE: #groupaddsquid
#useraddsquid
Add suqid users and user groups
CODE: #exportCFLAGES = '-o2-mcpu=pentium4-march=pentium4-mmmx-msse-msse2 '
You can choose the appropriate parameters according to your CPU GCC-3.1 above can be optimized for the CPU:
CODE:Pentium2: -O2 -mcpu=i686 -march=i686 -mmmx
Pentium3: -O2 -mcpu=pentium3 -march=pentium3 -mmmx -msse
Pentium4: -O2 -mcpu=pentium4 -march=pentium4 -mmmx -msse -msse2
#./configure --prefix=/usr/local/squid --enable-gnuregex --enable-async-io=80
--enable-icmp --enable-kill-parent-hack --enable-snmp
--disable-ident-lookups --enable-cahce-digests
--enable-arp-acl --enable-err-language="Simplify_Chinese"
--enable-default-err-languages="Simplify_Chinese"
--enable-poll --enable-linux-netfilter --enable-underscore
#make
#make install