Build and configure squid Proxy Server and squid Proxy Server
System Environment: CentOS release 6.5 (Final) (minimal installation)
1. Install squid
# Yum-y install squid
2. Edit the configuration file (Forward proxy)
# Vim/etc/squid. conf
Add the following content:
Cache_dir ufs/var/spool/squid 1000 16 256
Cache_mem 128 MB
Refresh_pattern \. (jpg | png | gif | js | css | mp3 | mp4) 1440 20% 2880 ignore-reload
Visible_hostname rhel
Start squid service
#/Etc/init. d/squid start
Test whether the configuration is successful first in the browser:
Configure Internet Options, connections, LAN Settings, and proxy servers in the browser. Enter ip Address: 10.10.162 and port: 3128.
Use tcpdump on the squid side to check whether the squid configuration has taken effect. If a large number of data flow packets are generated, it indicates that the squid configuration is successful.
# Tcpdump-nn port 3128
Use curl for testing:
# Curl-x127.0.0.1: 3128 www.aminglinux.com-I
3. Restrict Website access
# Vim/etc/squid. conf
Add the following content:
Acl httpd proto HTTP
Acl good_domain dstdomain .baidu.com .aminglinux.com .lishiming.net
Http_access allow good_domain
Http_access deny! Good_domain
Check the syntax of the configuration file:
# Squid-kcheck
No problem restarting squid
# Service squid restart
Or reload the configuration file.
# Squid-kre
Iv. Reverse Proxy
Http_port 80 accel vhost vport
Cache_peer 61.135.169.125 parent 80 0 originserver name =
Cache_peer_domain a www.baidu.com
Cache_peer 61.135.157.156 parent 80 0 originserver name = B
Cache_peer_domain B www.qq.com