设为首页收藏本站

LinuxTone | 运维专家网论坛 - 最棒的Linux运维与开源架构技术交流社区!

 找回密码
 注册

用新浪微博连接

一步搞定

QQ登录

只需一步,快速开始

查看: 1816|回复: 1

[Squid] squid 2.6升级指南 [复制链接]

LT管理团队

社区首席勤杂工

Rank: 9Rank: 9Rank: 9

签到
81
注册时间
2008-5-19
最后登录
2012-5-3
在线时间
1762 小时
阅读权限
200
积分
14979
帖子
2524
主题
1200
精华
25
UID
1

LT总司令

发表于 2009-5-30 15:40:43 |显示全部楼层
http_port 80 改为
http_port 80 vhost

cache_access_log ... 改为
access_log ...

no_cache ...改为
cache ...

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_single_host off
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
删除
改为(定义内部DNS或hosts文件 或根据具体情况定义acl 设置转发)
acl ipcndm   dstdomain  .ipcn.org
cache_peer www.ipcn.org parent 80 0 no-query no-digest no-netdb-exchange login=PASS originserver
cache_peer_access www.ipcn.org allow ipcndm
cache_peer_access www.ipcn.org deny all

always_direct allow !ipcndm
never_direct allow ipcndm

其他还有很多
比如:不记图片类访问日志
acl nolog urlpath_regex \.gif \.jpg \.css \.js \.swf
access_log /data/squid/var/logs/access.log common !nolog

squid.conf 配置官方参数相关改动说明:
1.    http_port加参数
a)    http_port 80 vhost
2.    cache_peer hostname type http_port icp_port [options]
a)    originserver
b)    sourcehash
c)    name=xxx 加速同一机器时不同端口时定位用
3.    no_cache 改为 cache
a)    cache deny QUERY
4.    cache_vary on
a)    Set to off to disable caching of Vary:in objects.
5.    broken_vary_encoding 不要相信apache的 ETag 和gzip版本一样
a)    acl apache rep_header Server ^Apache (补注: 新版apache 已加-gzip标记)
b)    broken_vary_encoding allow apache
6.    logformat
a)   
b)    %>a %ui %un [%tl] "%rm http://%{Host}>h%ru HTTP/%rv" %Hs %<st \
"%{Referer}>h" "%{User-Agent}>h" "%{Cookie:;cookie_name}>h"
c)    apache参考:LogFormat "%h %l %u %t \"%m http://%v%U %H\" %>s %b \
\"%{Referer}i\" \"%{User-Agent}i\" \"%{cookie}n\"" squid

d)    下面是squid默认提供的
e)    #logformat squid  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
f)    #logformat squidmime  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A \
    %mt [%>h] [%<h]
g)    #logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st %Ss:%Sh
h)    #logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st \
    "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
7.    access_log
a)    cache_access_log改为access_log
b)    access_log <filepath> [<logformat name> [acl acl ...]]
8.    check_hostnames on
9.    allow_underscore on

10.    refresh_pattern 增加
a)    ignore-no-cache
b)    ignore-private
c)    ignore-auth
11.    collapsed_forwarding off
12.    refresh_stale_hit 0 seconds
13.    follow_x_forwarded_for deny all
14.    acl_uses_indirect_client on
15.    log_uses_indirect_client on
16.    log_access    allow|deny acl acl...
17.    httpd_suppress_version_string off (不显示/具体版本号)
18.    httpd_accel_host删除
19.    httpd_accel_port删除
20.    httpd_accel_single_host删除
21.    httpd_accel_with_proxy删除
22.    httpd_accel_uses_host_header删除
23.    error_map http://your.server/error/404.shtml 404
24.    via on (这个要打开 这样fowarding loop detect/死循环检测才生效)

http://windtear.net/archives/2006/07/18/001034.html
感谢大家对linuxtone的支持!

Rank: 8Rank: 8

注册时间
2011-10-20
最后登录
2012-5-9
在线时间
27 小时
阅读权限
90
积分
6032
帖子
95
主题
2
精华
0
UID
15807
发表于 2012-2-3 17:27:21 |显示全部楼层
netseek兄,如果能用案例说明就更好了..呵呵
K.I.S.S

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

IT运维专家网感谢红之盟网络提供带宽支持

合作联系: QQ:67888954/MSN:cnseek@msn.com/mail:netseek@linuxtone.org

Archiver|手机版|感谢所有关心和支持过LinuxTone的朋友们 转载本站内容请注明原作者名及出处 ( 京ICP备08103151 )   |

GMT+8, 2012-5-23 10:33 , Processed in 0.113013 second(s), 12 queries , Memcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部