# 安裝 squid proxy ###### tags: `Proxy`, `Squid` PS. *\~夜晚的星空~* 原發表於 HiNet Xuite DATE: 01/30/2012 10:46:58 AM ## 安裝與設定 http://www.squid-cache.org/ 1. `yum install squid` (RH系列的linux可以這樣裝) 2. 設定config: ``` $ cat /etc/squid/squid.conf # Set the acl acl allowdomain dstdomain "/etc/squid/allowdomain.txt" acl allowip dst "/etc/squid/allowip.txt" acl Safe_ports port 80 acl Safe_ports port 443 # Bind the acl http_access deny !Safe_ports http_access allow allowdomain http_access allow allowip http_access deny all # Set proxy listening port http_port 80 # Set read only (Without cache) cache_dir ufs /var/spool/squid 10 1 1 read-only cache_mem 0 MB # Set the parent proxy (If there is a parent proxy) cache_peer url.parent.proxy parent 80 3130 proxy-only no-query no-digest no-netdb-exchange cache_peer_access url.parent.proxy allow all # Ask for all request from parent, if you want. never_direct allow all # Set proxy manager. cache_mgr admin@your.net.work $ cat /etc/squid/allowdomain.txt www.google.com www.google.com.tw .gov.tw .edu.tw .microsoft.com .microsoft.com.tw .windowsupdate.com $ cat /etc/squid/allowip.txt 140.0.0.0/8 ``` 3. 設定開機自動啟動squid: `chkconfig squid on 4. 啟動squid: `/etc/init.d/squid start` 5. 要注意防火牆是否已開通,包含防火牆設備、iptables、hosts.allow等設定,這樣clients才連得出來,也才有辦法導向。 ## 參考網站 * http://linux.vbird.org/