squid终于支持多核心了~~~~~~~~~~~
稳定版有2.7和3.1供选择 测试版3.2已经加入了SMP支持,可以最大利用处理器资源,3.1之前的所有版本都是不支持SMP和多CPU。
yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel wget tar -zvxf squid-3.2.0.18.tar.gz cd squid-3.2.0.18 ./configure --prefix=/usr/local/squid --enable-gnuregex --enable-async-io=80 --enable-cache-digests --enable-err-language="zh-cn" --enable-default-err-language="zh-cn" --enable-epoll --disable-internal-dns --with-filedescriptors=20480 --enable-kill-parent-hack make make install#创建squid相关目录
groupadd squid #创建squid squid用户组 useradd -g squid -s /sbin/nologin #创建squid用户,并加入到squid组里,不允许登录系统 chown -R squid /usr/local/squid/ #修改squid的安装目录所属用户为squid用户 mkdir -p /var/cache1 #创建squid的第一个缓存目录 mkdir -p /var/cache2 #创建squid的第二个缓存目录 chown squid.squid -R /var/cache1 /var/squid2 #设置目录所有者 chmod -R 777 /var/cache1 /var/squid #设置目录权限#配置squid
将squid的初始配置文件备份,我们要重新创建配置文件
mv /usr/local/squid/etc/squid.conf /usr/local/squid/etc/squid.conf.bak
vi /usr/local/squid/etc/squid.conf
max_filedescriptors 65535 visible_hostname rui acl SSL_ports port 443 acl Safe_ports port 80 acl CONNECT method CONNECT acl myip src localhost #http_access deny OverConnLimit #acl web1 src 117.21.227.134 #acl web2 src ..... http_access allow manager localhost http_access deny !Safe_ports http_access deny CONNECT !SSL_ports acl OverConnLimit maxconn 300 http_access deny OverConnLimit http_access allow all #header_access X-Forwarded-For allow all #acl_uses_indirect_client on #follow_x_forwarded_for allow all allow_underscore on half_closed_clients off cache_peer 222.174.95.21 parent 9011 0 no-query originserver name=web21 cache_peer 122.226.213.41 parent 80 0 no-query originserver name=web41 http_port 80 accel vhost vport cache_peer_domain web21 .upbar.net mypig.upbar.net .mypig.net .8goo.com .vitas.com.cn .ibar.cc .360loss.com .99zyz.com cache_peer_domain web21 .grow100.com.cn .jpstore.net .jk0769.com .maxmancapsule.com .maxmancapsule.com.cn .maxmancapsules.com.tw .72sun.com .30jf.com .356jf.com .24jf.com .aidashan.com .she36.com cache_peer_domain web21 .grow100.net .gao36.com .gao36.net .way200.com .easy900.com .show1000.com .gft400.com .topgouwu.net cache_peer_domain web21 .igaofei.com .igaofei.net .mek123.com .mek123.net .yugutoo.com yututoo.com cache_peer_domain web41 .bibe.cn .yein.cc .youxia.cn cache_peer_access web21 allow all cache_peer_access web41 allow all forwarded_for on acl QUERY urlpath_regex cgi-bin .cgi .php .avi .wmv .rm .ram .mpg .mpeg .zip .exe .asp .aspx cache deny QUERY reload_into_ims on refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320 refresh_pattern -i \.html 1440 100% 129600 reload-into-ims refresh_pattern -i \.shtml 1440 100% 129600 reload-into-ims refresh_pattern -i \.htm 1440 100% 129600 reload-into-ims refresh_pattern -i \.gif 1440 100% 129600 ignore-reload refresh_pattern -i \.jpg 1440 100% 129600 ignore-reload refresh_pattern -i \.png 1440 100% 129600 reload-into-ims refresh_pattern -i \.bmp 1440 100% 129600 reload-into-ims refresh_pattern -i \.swf 1440 100% 129600 reload-into-ims refresh_pattern -i \.flv 129600 100% 129600 ignore-reload refresh_pattern -i \.js 1440 100% 129600 reload-into-ims refresh_pattern -i \.css 1440 100% 129600 reload-into-ims pid_filename /usr/local/squid/var/logs/squid.pid #logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt #cache_log /usr/local/squid/var/logs/cache.log #access_log /usr/local/squid/var/logs/access.log access_log /dev/null cache_log /dev/null cache_store_log none #error_directory none cache_mem 256 MB memory_pools_limit 312 MB maximum_object_size_in_memory 4096 KB max_open_disk_fds 0 minimum_object_size 0 KB maximum_object_size 4096 KB maximum_object_size_in_memory 4096 KB memory_replacement_policy lru cache_dir ufs /var/cache1 1024 16 256 #cache_dir null /tmp
EOF