Chinaunix首页 | 论坛 | 博客
  • 博客访问: 801964
  • 博文数量: 162
  • 博客积分: 5308
  • 博客等级: 大校
  • 技术积分: 2152
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-15 19:09
个人简介

DevOps让系统管理更轻松。

文章分类

全部博文(162)

文章存档

2014年(28)

2012年(10)

2011年(6)

2009年(60)

2008年(58)

我的朋友

分类: LINUX

2012-04-21 19:53:44

开始squid的安装配置:
wget
#useradd squid
#groupadd squid
#tar zxvf squid-3.0.STABLE2.tar.gz
#cd squid-3.0.STABLE2
#./configure --prefix=/date/squid/squid --disable-carp --with-aufs-threads=32 --with-pthreads --enable-storeio='ufs,aufs,coss,null' --enable-disk-io='AIO,Blocking' --enable-removal-policies='heap,lru' --disable-wccp --enable-kill-parent-hack --disable-snmp --disable-poll --disable-select --enable-auth=basic --with-aio --disable-ident-lookup --with-filedescriptors=65536
#make
#make install
可能需要创建一些文件 这些都是配置文件中需要调用的(这个要注意文件的属主和权限)
#cd /date/squid/squid/var/logs/
#touch cache.log
#chmod 755 cache.log
#chown squid:squid cache.log
#touch page_zs_access_log
#chmod 755 page_zs_access_log
#chown squid:squid page_zs_access_log
#cd /date/squid/etc/
[root@web1 squid]# vi squid.conf
visible_hostname test.com
 http_port 3128 9000
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
 cache_mem 100 MB
 minimum_object_size 0 KB
 maximum_object_size_in_memory 8 KB
 cache_dir ufs /var/spool/squid 100 16 256
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern .               0       20%     4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
#http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow all
http_reply_access allow all
icp_access allow all
coredump_dir /var/spool/squid

测试:
/date/squid/sbin/squid -z
/date/squid/sbin/squid -NCd1
start/stop
/date/squid/sbin/squid -sD
/date/squid/sbin/squid -k shutdown
可以根据这个测试命令用来验证squid.conf的语法和配置
/date/squid/sbin/squid -k parse
 
[root@web1 ~]# netstat -antup|grep 3128
tcp        0      0 0.0.0.0:3128                0.0.0.0:*                   LISTEN      8027/(squid)       
tcp        0      0 10.10.10.10:3128            10.10.10.1:1145             ESTABLISHED 8027/(squid) 
 
可以查看下命中率及其他相关信息
#/date/squid/sbin/squidclient -p 80 -h localhost mgr:info
[root@web1 ~]# squidclient -p 3128 -h localhost mgr:info
HTTP/1.0 200 OK
Server: squid/2.5.STABLE6
Mime-Version: 1.0
Date: Sun, 31 Aug 2008 21:15:34 GMT
Content-Type: text/plain
Expires: Sun, 31 Aug 2008 21:15:34 GMT
Last-Modified: Sun, 31 Aug 2008 21:15:34 GMT
X-Cache: MISS from test.com
Proxy-Connection: close
Squid Object Cache: Version 2.5.STABLE6
Start Time:     Sun, 31 Aug 2008 21:13:56 GMT
Current Time:   Sun, 31 Aug 2008 21:15:34 GMT
Connection information for squid:
        Number of clients accessing cache:      2
        Number of HTTP requests received:       1
        Number of ICP messages received:        0
        Number of ICP messages sent:    0
        Number of queued ICP replies:   0
        Request failure ratio:   0.00
        Average HTTP requests per minute since start:   0.6
        Average ICP messages per minute since start:    0.0
        Select loop called: 227 times, 430.991 ms avg
Cache information for squid:
        Request Hit Ratios:     5min: 0.0%, 60min: 0.0%
        Byte Hit Ratios:        5min: -0.0%, 60min: -0.0%
        Request Memory Hit Ratios:      5min: 0.0%, 60min: 0.0%
        Request Disk Hit Ratios:        5min: 0.0%, 60min: 0.0%
        Storage Swap size:      0 KB
        Storage Mem size:       104 KB
        Mean Object Size:       0.00 KB
        Requests given to unlinkd:      0
Median Service Times (seconds)  5 min    60 min:
        HTTP Requests (All):   0.00000  0.00000
        Cache Misses:          0.00000  0.00000
        Cache Hits:            0.00000  0.00000
        Near Hits:             0.00000  0.00000
        Not-Modified Replies:  0.00000  0.00000
        DNS Lookups:           0.00000  0.00000
        ICP Queries:           0.00000  0.00000
Resource usage for squid:
        UP Time:        97.835 seconds
        CPU Time:       0.545 seconds
        CPU Usage:      0.56%
        CPU Usage, 5 minute avg:        0.87%
        CPU Usage, 60 minute avg:       0.87%
        Process Data Segment Size via sbrk(): 2112 KB
        Maximum Resident Size: 0 KB
        Page faults with physical i/o: 0
Memory usage for squid via mallinfo():
        Total space in arena:    2112 KB
        Ordinary blocks:         2028 KB      3 blks
        Small blocks:               0 KB      0 blks
        Holding blocks:           200 KB      1 blks
        Free Small blocks:          0 KB
        Free Ordinary blocks:      83 KB
        Total in use:            2228 KB 96%
        Total free:                83 KB 4%
        Total size:              2312 KB
Memory accounted for:
        Total accounted:          150 KB
        memPoolAlloc calls: 1206
        memPoolFree calls: 512
File descriptor usage for squid:
        Maximum number of file descriptors:   1024
        Largest file desc currently in use:     12
        Number of file desc currently in use:   10
        Files queued for open:                   0
        Available number of file descriptors: 1014
        Reserved number of file descriptors:   100
        Store Disk files open:                   0
Internal Data Structures:
            26 StoreEntries
            26 StoreEntries with MemObjects
            25 Hot Object Cache Items
             0 on-disk objects
阅读(859) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~