Squid_2.6_stable 安装和配置
时间:2006-12-15 来源:loesprite
#tar vxzf squidXXX.tar.gz
#cd squidXXX
#./configure --enable-linux-netfilter --prefix=/usr/local/squid2.6 --enable-underscores --enable-gnuregex --enable-delay-pools --enable-kill-parent-hack --enable-arp-acl --enable-ssl
# make all
...
#make install
...
#vi /usr/local/squid2.6/etc/squid.conf
...
http_port 3128 transparent
...
visible_hostname netgate(hostname命令的返回值)
...
注明内网的网段:
acl our_networks src 192.168.0.0/22
http_access allow our_networks
做了以上工作之后,squid的基本配置就完成了。
关于https的代理问题,很多朋友都问到,官方文档中是这样说的:
“This is really only useful for situations where you are running squid in accelerator mode and you want to do the SSL work at the accelerator level.”
就是说https的代理功能只用在加速apache服务器的访问的情况。
下面简单介绍一些常用策略:
要求禁止BT下载,做如下策略:
acl btfile urlpath_regex -i .torrent$ #禁止下载后缀名为“.torrent”的文件
acl notbt url_regex -i btn #可以打开url中含有“btn”的链接
acl btdenywords url_regex -i bt #禁止打开url中含有“bt”(大小写均匹配)的链接
http_access allow notbt
http_access deny btdenywords
http_access deny btfile
禁止登录的网站:
acl deny_address dstdomain .qq.com .verycd.com
http_access allow !deny_address
#chown -R nobody /usr/local/squid2.6/var/logs/
#mkdir -p nobody /usr/local/squid2.6/var/cache
#chown -R nobody /usr/local/squid2.6/var/cache/
建立缓存:
#/usr/local/squid2.6/sbin/squid -z
#/usr/local/squid2.6/sbin/squid -N -d1
修改squid.conf文件之后,重新读取配置的命令是:
/usr/local/squid2.6/sbin/squid -k reconfigure
注:如果想某些页面(需要该页面的IP)不缓存,则在iptables设置里面(转发3128句之前)添加一句:
iptables -t nat -A PREROUTING --dst $IP -j ACCEPT
本文参考资料见Squid指南.rar
#cd squidXXX
#./configure --enable-linux-netfilter --prefix=/usr/local/squid2.6 --enable-underscores --enable-gnuregex --enable-delay-pools --enable-kill-parent-hack --enable-arp-acl --enable-ssl
# make all
...
#make install
...
#vi /usr/local/squid2.6/etc/squid.conf
...
http_port 3128 transparent
...
visible_hostname netgate(hostname命令的返回值)
...
注明内网的网段:
acl our_networks src 192.168.0.0/22
http_access allow our_networks
做了以上工作之后,squid的基本配置就完成了。
关于https的代理问题,很多朋友都问到,官方文档中是这样说的:
“This is really only useful for situations where you are running squid in accelerator mode and you want to do the SSL work at the accelerator level.”
就是说https的代理功能只用在加速apache服务器的访问的情况。
下面简单介绍一些常用策略:
要求禁止BT下载,做如下策略:
acl btfile urlpath_regex -i .torrent$ #禁止下载后缀名为“.torrent”的文件
acl notbt url_regex -i btn #可以打开url中含有“btn”的链接
acl btdenywords url_regex -i bt #禁止打开url中含有“bt”(大小写均匹配)的链接
http_access allow notbt
http_access deny btdenywords
http_access deny btfile
禁止登录的网站:
acl deny_address dstdomain .qq.com .verycd.com
http_access allow !deny_address
#chown -R nobody /usr/local/squid2.6/var/logs/
#mkdir -p nobody /usr/local/squid2.6/var/cache
#chown -R nobody /usr/local/squid2.6/var/cache/
建立缓存:
#/usr/local/squid2.6/sbin/squid -z
#/usr/local/squid2.6/sbin/squid -N -d1
修改squid.conf文件之后,重新读取配置的命令是:
/usr/local/squid2.6/sbin/squid -k reconfigure
注:如果想某些页面(需要该页面的IP)不缓存,则在iptables设置里面(转发3128句之前)添加一句:
iptables -t nat -A PREROUTING --dst $IP -j ACCEPT
本文参考资料见Squid指南.rar
|
相关阅读 更多 +