Chinaunix首页 | 论坛 | 博客
  • 博客访问: 595881
  • 博文数量: 187
  • 博客积分: 10025
  • 博客等级: 上将
  • 技术积分: 2990
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-18 17:40
文章分类

全部博文(187)

文章存档

2010年(1)

2009年(23)

2008年(163)

我的朋友

分类: LINUX

2009-04-08 14:27:43

vi /etc/profile
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
export   CHOST CFLAGS CXXFLAGS
ulimit -u unlimited
ulimit -n 65535

soure /etc/profile
tar zxvf squid-3.0.PRE5-20070403.tar.tar
cd squid-3.0.PRE5-20070403\

vi config.sh
#!/bin/bash
./configure --prefix=/usr/local/squid3 \
--enable-dlmalloc \
--enable-debug-cbdata \
--enable-async-io=100 \
--with-pthreads \
--enable-storeio="aufs,coss,diskd,ufs" \
--enable-removal-policies="heap,lru" \
--enable-icmp \
--enable-delay-pools \
--enable-useragent-log \
--enable-referer-log \
--disable-wccp \
--disable-wccpv2 \
--enable-kill-parent-hack \
--enable-arp-acl \
--enable-snmp \
--enable-default-err-language=Simplify_Chinese \
--enable-err-languages="Simplify_Chinese English" \
--disable-poll \
--enable-epoll \
--disable-ident-lookups \
--disable-internal-dns \
--enable-truncate \
--enable-underscores \
--enable-basic-auth-helpers="NCSA" \
--enable-stacktrace \
--with-winbind-auth-challenge \
--enable-large-cache-files --with-large-files \
--with-maxfd=32768\
--enable-ssl \
--enable-x-accelerator-vary

make &&make install

chmod -R 777 cache目录
chmod -R 777 /usr/local/squid3/var/

创建缓存目录

/usr/local/squid3/sbin/squid –z

测试Squid运行状况


/usr/local/squid3/sbin/squid –NCd1

成功后将出现"Ready to serve requests".否则请检查配置文件''

注意:配置文件中需要修改的有两处


http_port 80 accel vhost vport


acl acceleratedProtocol protocol HTTP
改为
acl acceleratedProtocol proto HTTP

配置参考
http_port 80 accel vhost vport

cache_mem 512 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 10240 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 2048 KB
memory_replacement_policy lru


emulate_httpd_log on
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %h" "%{User-Agent}>h" %Ss:%Sh
access_log /usr/local/squid3/var/logs/access.log
cache_log /usr/local/squid3//var/logs/cache.log
debug_options ALL,9
#redirect_rewrites_host_header off
cache_peer test1.com    parent 80   0   no-query originserver name=a1
cache_peer test2.com    parent 80   0   no-query originserver name=a2
cache_peer_domain a1 test1.com
cache_peer_domain a2 test2.com
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

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 SSL_ports port 443 563
acl Safe_ports port 80       # http
acl Safe_ports port 81
acl LanSrc src 192.168.4.0/24
acl LanDst dst 192.168.4.0/24
acl LanDstDM dstdomain .test1.com .test2.com

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 LanSrc
http_access allow LanDst
http_access allow LanDstDM
http_access deny   all

cache_effective_user nobody
cache_effective_group nobody
cache_replacement_policy lru


cache_dir aufs /cache1/squid 10240 32 64
cache_dir aufs /cache2/squid 10240 32 64
cache_log /usr/local/squid3/var/logs/cache.log
cache_store_log none
#cache_swap_log /usr/local/squid3/var/logs/swap.log
log_ip_on_direct on
pid_filename /usr/local/squid3/var/logs/squid.pid
visible_hostname localhost
logfile_rotate 30

refresh_pattern ^ftp:           1440 20%     10080
refresh_pattern ^gopher:        1440 0%    1440
refresh_pattern .             0    20%     4320


client_persistent_connections off
server_persistent_connections off
阅读(1255) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~