wget http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE9.tar.gz
useradd squid
groudadd squid
tar zxvf squid-3.0.STABLE9.tar.gz
cd squid-3.0.STABLE9
./configure --prefix=/usr/local/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 install
cd /usr/local/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 /usr/local/squid/etc/
vi squid.conf

visible_hostname www.test.com
http_port 80 vhost vport
cache_mem 512 MB
maximum_object_size_in_memory 2048 KB
minimum_object_size 0 KB
maximum_object_size 32768 KB
memory_replacement_policy lru
cache_dir ufs /tmp 512 16 256
#设置缓存目录大小为512MB 一级目录为16个二级目录为256个
max_open_disk_fds 0
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /usr/local/squid/var/logs/page_zs_access_log combined
pid_filename  /usr/local/squid/var/logs/squid.pid
cache_store_log none
cache_peer  parent 81  0 no-query no-digest originserver name=www
cache_peer_domain www www.yemaosheng.com
cache_peer_access www allow all
http_access allow all
acl QUERY urlpath_regex cgi-bin .php .cgi .avi .wmv .rm .ram .mpg .mpeg .zip .exe
cache deny QUERY
#禁止缓存php cgi avi...exe一类的文件
cache_effective_user squid
cache_effective_group squid

/usr/local/squid/sbin/squid -s


   listen       81;
   server_name  www.yemaosheng.com;
   index index.html index.htm index.php;
   root  /data/htdocs/www;
   location ~ .*\.(php|php5)?$
     fastcgi_index index.php;
     include fcgi.conf;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.