캐싱된 데이터를 내부망을 통해 바로 전송할 수 있기 때문에 WAN 구간의 대역폭 절감과 함께
빠른 속도로 클라이언트에게 제공해 줄 수 있으며, 사용자가 접근하지 말아야 할 서버로의 연결을 차단 할 수도 있다.
[설치]
yum install squid
[서비스 활성화]
chkconfig squid on
[프록시 서버 포트 구성]
vi +62 /etc/squid/squid.conf
http_port 3128 를 원하는 포트번호로 지정
[프록시 서버 포트 방화벽 구성]
iptables -I INPUT 4 -p tcp -m state --state NEW --dport 3128 -j ACCEPT
service iptables save
[프록시 서버 설정]
vi /etc/squid/squid.conf
1 # 2 # Recommended minimum configuration: 3 # 4 acl manager proto cache_object 5 acl localhost src 127.0.0.1/32 ::1 6 acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 7 acl Proxy_client src 192.168.100.0/24 < 프록시 서버를 허용할 클라이언트 또는 IP대역을 'Proxy_client' 레이블로 지정 8 acl drop_site dst www.delmaster.net < 서버 연결을 거부 할 사이트 또는 IP를 'drop_site' 레이블로 지정 9 # Example rule allowing access from your local networks. 10 # Adapt to list your (internal) IP networks from where browsing 11 # should be allowed 12 acl localnet src 10.0.0.0/8 # RFC1918 possible internal network 13 acl localnet src 172.16.0.0/12 # RFC1918 possible internal network 14 acl localnet src 192.168.0.0/16 # RFC1918 possible internal network 15 acl localnet src fc00::/7 # RFC 4193 local private network range 16 acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) mac hines 17 18 acl SSL_ports port 443 19 acl Safe_ports port 80 # http 20 acl Safe_ports port 21 # ftp 21 acl Safe_ports port 443 # https 22 acl Safe_ports port 70 # gopher 23 acl Safe_ports port 210 # wais 24 acl Safe_ports port 1025-65535 # unregistered ports 25 acl Safe_ports port 280 # http-mgmt 26 acl Safe_ports port 488 # gss-http 27 acl Safe_ports port 591 # filemaker 28 acl Safe_ports port 777 # multiling http 29 acl CONNECT method CONNECT 30 31 # 32 # Recommended minimum Access Permission configuration: 33 # 34 # Only allow cachemgr access from localhost 35 http_access allow manager localhost 36 http_access deny drop_site 37 38 # Deny requests to certain unsafe ports 39 http_access deny !Safe_ports 40 41 # Deny CONNECT to other than secure SSL ports 42 http_access deny CONNECT !SSL_ports 43 44 # We strongly recommend the following be uncommented to protect innocent 45 # web applications running on the proxy server who think the only 46 # one who can access services on "localhost" is a local user 47 #http_access deny to_localhost 48 49 # 50 # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS 51 # 52 53 # Example rule allowing access from your local networks. 54 # Adapt localnet in the ACL section to list your (internal) IP networks 55 # from where browsing should be allowed 56 http_access allow localnet 57 http_access allow localhost 58 http_access allow Proxy_client < 프록시 클라이언트 허용 59 60 # And finally deny all other access to this proxy 61 http_access deny all 62 63 # Squid normally listens to port 3128 64 http_port 3128 65 66 # Uncomment and adjust the following to add a disk cache directory. 67 cache_dir ufs /var/spool/squid 100 16 256 < 캐시 파일의 최대용량(100), 하위 디렉토리 수(16)와 각 하위 디렉토리에서 가질 수 있는 최대 하위 디렉토리 갯수 68 69 # Leave coredumps in the first cache dir 70 coredump_dir /var/spool/squid < 캐시 파일이 저장되는 경로 71 72 # Add any of your own refresh_pattern entries above these. 73 refresh_pattern ^ftp: 1440 20% 10080 74 refresh_pattern ^gopher: 1440 0% 1440 75 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 76 refresh_pattern . 0 20% 4320 77 78 visible_hostname Proxy_client < 프록시 서버를 이용하는 클라이언트 레이블 정의