安装
tar zxvf squid-3.1.11.tar.gz
cd squid-3.1.11
./configure --prefix=/usr/local/squid --enable-delay-pools --enable-snmp --enable-cache-digests --enable-auth-modules="NCSA"
make all
make install
 
配置
修改/usr/local/squid/etc/squid.conf
http_port 8080                                                                                #设置监听端口
cache_mem 512 MB                                                                        #设置内存缓冲区大小
cache_dir ufs /var/spool/squid 10240 16 256                        #cache文件存储机制,存储到硬盘位置目录大小        一级目录数目 二级目录数目
cache_log /var/log/squid/cache.log                                        #设置缓存日志
cache_access_log /var/log/squid/access.log                        #设置访问日志文件
cache_store_log /var/log/squid/store.log                        #设置网页缓存日志
cache_effective_user squid                                                        #设置squid的援有者
cache_effective_group squid                                                        #设置squid的所属组
dns_nameservers 8.8.8.8                                                        #设置DNS服务器地址
visible_hostname localhost                                                                #设置squid可见主机名
cache_mgr cx@work.qeedoo.com                                                                   #设置管理员E-mail地址
acl allip src all                                                                         #访问控制列表
http_access allow all
delay_pools 1                                                                                       #流量控制
delay_class 1 2
delay_access 1 allow all
delay_parameters 1 -1/-1 200000/200000
 
常用命令
/usr/local/squid/sbin/squid -k parse                        #检查配置文件
/usr/sbin/squid -z                                                                        #初始化缓冲区目录
/usr/local/squid/sbin/squid                                                        #启动服务
/usr/sbin/squid -k reconfigure                                        #重载配置文件
/usr/sbin/squid -k rotate                                                        #对LOG文件做轮换;所谓的轮换就是在日志增长到太大的时候,重新命名一组新的文件开始使用
/usr/sbin/squid -k shutdown                                                        #关闭LOG后停止服务
/usr/sbin/squid -k kill                                                #直接停止服务