centos5下squid3.1最新安装笔记

wget http://www.squid-cache.org/Versions/v3/3.1/squid-3.1.10.tar.gz

yum -y instsll gcc*

./configure --prefix=/usr/local/squid \
       --enable-gnuregex --enable-carp --enable-async-io=80 \
       --enable-storeio=aufs,diskd,ufs,null --enable-removal-policies=heap,lru \
       --enable-icmp --enable-delay-pools --enable-useragent-log --enable-snmp \
        --enable-arp-acl --enable-htcp --enable-underscores --enable-auth \
        --enable-x-accelerator-vary \
      --enable-cache-digests --enable-poll \
        --enable-linux-tproxy  --enable-linux-netfilter --with-pthreads  \
      --with-aio --with-filedescriptors=65536 \
        --enable-err-languages="Simplify_Chinese English" \
      --enable-default-err-language="Simplify_Chinese" \

make

make install

vi /usr/local/squid/etc/squid.conf

visible_hostname squid.cwd.com
http_port 80 vhost vport
cache_mem 512 MB
maximum_object_size_in_memory 2048 KB
memory_replacement_policy lru
cache_dir ufs /tmp 512 16 256
max_open_disk_fds 0
minimum_object_size 0 KB
maximum_object_size 32768 KB
#logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h""%{User-Agent}>h" %Ss:%Sh
cache_store_log none
cache_peer xxx.xxx.xxx.xxx parent 80  0 no-query no-digest originserver name=www    #需要反向代理的源WEB服务器,可以添加多个
cache_peer xxx.xxx.xxx.xxx parent 80  0 no-query no-digest originserver name=yyy   #需要反向代理的源WEB服务器,可以添加多个
cache_peer_domain www cdn.xxx.cn
cache_peer_domain yyy cdntest.xxx.cn
#cache_peer_access www allow all        #添加多个不同IP下的域名时,可以屏蔽掉该行
http_access allow all
cache_effective_user nobody
cache_effective_group nobody
cache_mgr [email protected]
在最后可以加
#refresh_pattern ^ftp: 60 20% 10080
#refresh_pattern ^gopher: 60 0% 1440
#refresh_pattern ^gopher: 60 0% 1440
#refresh_pattern . 0 20% 1440
refresh_pattern -i \.css$       360     50%     2880    
refresh_pattern -i \.js$        1440    50%     2880    
refresh_pattern -i \.html$      720     50%     1440    
refresh_pattern -i \.jpg$       1440    90%     2880    
refresh_pattern -i \.gif$       1440    90%     2880    
refresh_pattern -i \.swf$       1440    90%     2880    
refresh_pattern -i \.jpg$       1440    50%     2880    
refresh_pattern -i \.png$       1440    50%     2880    
refresh_pattern -i \.bmp$       1440    50%     2880    
refresh_pattern -i \.doc$       1440    50%     2880     
refresh_pattern -i \.ppt$       1440    50%     2880     
refresh_pattern -i \.xls$       1440    50%     2880     
refresh_pattern -i \.pdf$       1440    50%     2880     
refresh_pattern -i \.rar$       1440    50%     2880     
refresh_pattern -i \.zip$       1440    50%     2880     
refresh_pattern -i \.txt$       1440    50%     2880   

chmod 777 /usr/local/squid/var

chmod 777 /usr/local/squid/var/logs


/usr/local/squid/etc/squid -z

/usr/local/squid/etc/squid -k parse  测试配置文件

/usr/local/squid/etc/squid -k reconfigure  重置配置文件

/usr/local/squid/etc/squid -k shutdown  关闭squid

/usr/local/squid/etc/squid -s 开启squid 后台

/usr/local/squid/etc/squid -N -d1 前台开启squid

 

你可能感兴趣的:(centos,职场,squid,休闲)