职业IT人-IT人生活圈

 找回密码
 成为会员
搜索
查看: 1314|回复: 2

正向代理服务器squid

[复制链接]
我同意 发表于 2008-7-20 09:55 | 显示全部楼层 |阅读模式
正向代理服务器squid
squid代理
./configure --prefix=/opt/squid --enable-async-io=40 --disable-icmp --disable-delay-pools --enable-kill-parent-hack --disable-arp-acl --enable-poll --disable-ident-lookups --disable-internal-dns --enable-underscore --enable-linux-netfilter --enable-cache-digests --enable-snmp --enable-htcp
*对编译项目的解释:
--prefix 为编译squid所存放的目录,这里为/opt/squid
--enable-delay-pools 此选项使能一个延时池,这样能对某些特定的请求限制额定带宽。
--enable-snmp 此选项可以让mrtg使用snmp协议对服务器的流量状态进行监测,因此必须选择此项,使squid支持snmp接口。(可选项,如果对squid进行mrtg流量监控就打开)
--enable-cache-digests 使能缓存摘要,本来此项目的是为了在squid集群服务之间迅速发现缓存对象,这里在本地使用,可以加快请求时,检索缓存内容的速度。

--enable-async-io=40:这个主要是设置async模式来运行squid,我的理解是设置用线程来运行squid,如果服务器配置很不错,有1g以上内存,cpu使用smp的方式的话可以考虑设成160或者更高。如果服务器比较糟糕就根据实际情况设了。另外此项还另cache文件支持aufs
--enable-underscore  允许解析的url中出现下划线,因为默认情况下squid会认为带下划线的url是非法的,并拒绝访问该地址
--disable-icmp  禁止icmp支持
--enable-kill-parent-hack  关掉suqid的时候,连同父进程一起关掉
--enable-arp-acl :可以在规则设置中直接通过客户端的mac地址进行管理,防止客户使用ip欺骗
--enable-poll :应启用poll()函数
--enable-linux-netfilter :可以支持透明代理
make
make install

groupadd squid   建立squid组
useradd -g squid squid  建立squid用户
http_port 3128
ipcache_size 1024
hierarchy_stoplist \\.jsp
acl query urlpath_regex \\.jsp
no_cache deny query
cache_mem 84 mb
cache_swap_low 70
cache_swap_high 95
maximum_object_size_in_memory 200 kb
refresh_pattern .       0       20%     10080
dns_children 30
redirect_children 20
logfile_rotate 4
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl ftp proto ftp
acl localhost src 127.0.0.1/255.255.255.255
acl ssl_ports port 443 563
acl safe_ports port 80          # http
acl safe_ports port 21          # ftp
acl safe_ports port 443 563     # https, snews
acl safe_ports port 70          # gopher
acl safe_ports port 210         # wais
acl safe_ports port 1025-65535  # unregistered ports
acl safe_ports port 280         # http-mgmt
acl safe_ports port 488         # gss-http
acl safe_ports port 591         # filemaker
acl safe_ports port 777         # multiling http
acl connect method connect
#acl allow_ip src 192.168.2.0/24
acl allow_ip src 192.168.22.0/255.255.255.0
#acl denyurl url_regex -i ^http://chat
acl denyurl url_regex -i fastsmuthost.com
acl denyurl url_regex -i ^http://sohuchat
acl denyurl url_regex -i icq\\.
acl denyurlpath urlpath_regex -i \\.mp3$
acl denyurlpath urlpath_regex -i \\.wma$
acl denyurlpath urlpath_regex -i \\.wmv$
acl denyurlpath urlpath_regex -i \\.rm$
acl denyurlpath urlpath_regex -i \\.exe$
acl denyurlpath urlpath_regex -i \\.scr$
acl denyurlpath urlpath_regex -i \\.pif$
acl worktime time 8:45-12:00
acl worktime time 13:00-18:00
reply_body_max_size 1048576 allow all
http_access allow manager localhost
http_access deny manager
http_access deny ftp
http_access deny denyurl
http_access deny denyurlpath
http_access deny !safe_ports
http_access deny connect !ssl_ports
http_access allow allow_ip
http_access deny all
cache_effective_user squid
cache_effective_group squid
cache_dir ufs /opt/squid/cache 256 64 128
cache_log /opt/squid/var/logs/cache.log
cache_access_log /opt/squid/var/logs/access.log
cache_store_log /opt/squid/var/logs/store.log
pid_filename /opt/squid/var/logs/squid.pid
cache_mgr admin@editchina.comvisible_hostname bjsquid1
/opt/squid/sbin/squid -k parse  此命令用于检查squid.conf文件是否有错误
chown -r squid.squid var 改变var目录的所属人

mkdir cache  建立cache目录
chown -r squid.squid cache 改变cache目录的所属人

/opt/squid/sbin/squid -z 初始化cache 目录
/opt/squid/sbin/squid -n & 运行squid
走就走吧 发表于 2008-7-20 09:56 | 显示全部楼层
最好能配上说明。谢谢lz
妈妈咪呀 发表于 2012-3-27 22:50 | 显示全部楼层
对于那些外国产品我有时侯也用不习惯,就是英文不太会啊,还有有些配置不简单的,所以我
建议你还是用国内的软件吧,比如说那个美信CreCloud的(www.mxsoft.com),中文的,安装
简单,方便,还是免费的
您需要登录后才可以回帖 登录 | 成为会员

本版积分规则

QQ|手机版|小黑屋|网站帮助|职业IT人-IT人生活圈 ( 粤ICP备12053935号-1 )|网站地图
本站文章版权归原发布者及原出处所有。内容为作者个人观点,并不代表本站赞同其观点和对其真实性负责,本站只提供参考并不构成任何投资及应用建议。本站是信息平台,网站上部分文章为转载,并不用于任何商业目的,我们已经尽可能的对作者和来源进行了通告,但是能力有限或疏忽造成漏登,请及时联系我们,我们将根据著作权人的要求立即更正或者删除有关内容。

GMT+8, 2024-4-26 06:27 , Processed in 0.124973 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表