一,什么squid

Squid是一个高性能的代理缓存服务器,可以加快内部网浏览Internet的速度,提高客户机的访问命中率。Squid不仅支持HTTP协议, 还支持FTP、gopher、SSL和WAIS等协议。和一般的代理缓存软件不同,Squid用一个单独的、非模块化的、I/O驱动的进程来处理所有的客 户端请求。

Squid将数据元缓存在内存中,同时也缓存DNS查寻的结果,除此之外,它还支持非模块化的DNS查询,对失败的请求进行消极缓存。Squid支持SSL,支持访问控制。由于使用了ICP,Squid能够实现重叠的代理阵列,从而最大限度的节约带宽。

Squid能够增强访问控制,提高安全性。可以针对特定的的网站、用户、网络、数据类型实施访问控制等

二,安装squid

http://www.squid-cache.org/Versions/v3/3.1到上面的链接去下载squid,到目前为止,squid3.1.4是最新的。

 tar zxvf squid-...tar.gz -C  /home/zhangy
cd /home/zhangy/squid-..
./configure --prefix=/usr/local/squid
make && make install

说明:安装的时候./configure提供很多的参数选择,你可以查看./configure –help来获得,部分如下

–enable-icap-client    Enable the ICAP client.
–enable-ecap           support loadable content adaptation modules
–enable-useragent-log  Enable logging of User-Agent header
–enable-referer-log    Enable logging of Referer header
–disable-wccp          Disable Web Cache Coordination Protocol
像这个参数,安装的时候不加也没关系,可以通过配置来设置,像这样参数加的不好,安装的时候,还会出问题。

加了很多参数,安装报错

coss/StoreFScoss.cc:1:2: error: #error COSS Support is not stable yet in Squid-3. Please do not use.
make[3]: *** [StoreFScoss.lo] Error 1
make[3]: Leaving directory `/home/zhangy/squid-3.1.4/src/fs’
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/zhangy/squid-3.1.4/src’
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/zhangy/squid-3.1.4/src’
make: *** [all-recursive] Error 1

三,配置squid

当你装好后,在usr/local/squid/etc文件夹下面会有些文件,squid.conf是squid的配置文件,会产生一个配置文件的备份文件,如下图

squid安装

你可以把原来的配置文件删除掉,重新建个squid.conf,原配置文件有备份,上图中你可以看到squid.conf.default就是备份文件,squid.conf.documented这个文件,是3.14总的配置文件,有5000多行,你想的什么配置都能在里面找到。我的配置文件


 #
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src .../
acl localhost src ::/
acl to_localhost dst .../.../
acl to_localhost dst ::/ #自带端口设置
acl SSL_ports port
#acl Safe_ports port # http
acl Safe_ports port # ftp
acl Safe_ports port # https
acl Safe_ports port # gopher
acl Safe_ports port # wais
acl Safe_ports port - # unregistered ports
acl Safe_ports port # http-mgmt
acl Safe_ports port # gss-http
acl Safe_ports port # filemaker
acl Safe_ports port # multiling http
acl CONNECT method CONNECT # We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ? # Leave coredumps in the first cache dir
coredump_dir /usr/local/squid/var/cachebak #squid监听9000端口
http_port accel vhost vport #设置缓存内存值
cache_mem MB #设置内存池
memory_pools_limit MB #装入内存的文件大小
maximum_object_size_in_memory KB
#允许最小文件请求
minimum_object_size KB
#允许最大文件请求
maximum_object_size KB #设置缓存目录大小为256MB 一级目录为16个二级目录为256个
memory_replacement_policy lru
cache_dir ufs /usr/local/squid/var/cache
max_open_disk_fds #日志的格式
emulate_httpd_log on
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/access.log
cache_log /usr/local/squid/var/logs/cache.log
cache_store_log /usr/local/squid/var/logs/cache_store.log
pid_filename /usr/local/squid/var/logs/squid.pid #反向代理
cache_store_log none
cache_peer ... parent no-query no-digest originserver name=www
#...2为web的ip地址,80为web监听端口
cache_peer_domain www localhost
cache_peer_access www allow all #最大连接数为10
acl OverConnLimit maxconn
http_access deny OverConnLimit #防止百度盗链,给他一个无图标识
acl notallow referer_regex -i baidu
http_access deny notallow
deny_info http://51yip.com/noimage.gif notallow #允许本地管理
http_access allow Manager Localhost
http_access deny Manager
http_access allow all #哪些不缓存
acl QUERY urlpath_regex cgi-bin .php .cgi
cache deny QUERY cache_swap_low
cache_swap_high #用户组和人员
cache_effective_user zhangy
cache_effective_group users
</st>

上面的例子,只是实验用的配置,并且没有真正部署的配置

squid3.1系列官方配置说明 http://www.squid-cache.org/Versions/v3/3.1/cfgman/

squid3.0系列官方配置说明 http://www.squid-cache.org/Versions/v3/3.0/cfgman/

squid2.7系列官方配置说明 http://www.squid-cache.org/Versions/v2/2.7/cfgman/

squid2.6系列官方配置说明 http://www.squid-cache.org/Versions/v2/2.6/cfgman/

四,生成cache目录

利用./squid -z来生成目录

cd /usr/local/squid/sbin

./squid -z

说明:如果配置不出问题的话,生成目录不会有问题,你可以用./squid -k parse来测试配置文件

以下是我遇到的问题

五,squid启动

./squid

squid cache 服务器端的安装,配置的更多相关文章

  1. FastDFS_v5.05+nginx+cache集群安装配置手册

    转载请出自出处:http://www.cnblogs.com/hd3013779515/ 1.FastDFS简单介绍 FastDFS是由淘宝的余庆先生所开发,是一个轻量级.高性能的开源分布式文件系统, ...

  2. RHEL7-openldap安装配置二(客户端安装配置)

    LDAP用户登录流程: 当在客户端输入账号登录系统时,系统根据/etc/nsswitch.conf配置文件获取账号查找顺序,然后再根据PAM配置文件调用相关模块,对账号(/etc/passwd)及密码 ...

  3. Memcached&PHP-Memcache安装配置

    参考文档: memcache官网:https://memcached.org/ 参考:http://www.runoob.com/memcached/memcached-install.html 参考 ...

  4. centos5.5用phpstudy一键安装配置虚拟主机后,yum配置代理服务器squid

    最近因为工作需要,开发站点需要在lamp环境下跑网站,于是在win7上跑虚拟机装了一个centos5.5的linux 并用集成环境配置了一个lamp环境,这里用的是phpstudy的一键安装包,并配置 ...

  5. Squid安装配置和使用

    文:铁乐与猫 环境 centos 6.5 x64 安装 最简单的一种就是yum安装. yum install squid 版本 rpm -qa | grep squid squid-3.1.23-16 ...

  6. Linux环境下SVN服务器端的安装与配置

    最近尝试了下在Linux(CentOS6.5)环境下安装与配置SVN服务器端,安装过程中碰到了一些问题,参看了网友们分享的一些心得,并通过自己实际的操作,最终安装与配置成功!总的来说网上的说法芸芸,大 ...

  7. RHEL7-openldap安装配置一(服务器端安装配置)

    LDAP的术语:entry:一个单独的单元,使用DN(distinguish name)区别attribute:entry的属性,比如,如果entry是组织机构的话,那么它的属性包括地址,电话,传真号 ...

  8. SVN服务器端的安装和配置

    第2章 SVN 的下载与安装 服务器端的安装和配置 所有的开发人员用自己的账号登录进来就可以拥有对仓库里面的所有文件的读和写的权限 创建用户

  9. squid安装配置

    Squid做反向代理(192.168.1.69) squid.conf http_port 80 vhost vport visible_hostname pdd2.matrixcdn.net cac ...

随机推荐

  1. [BZOJ2654]tree 最小生成树+贪心

    2654: tree Time Limit: 30 Sec  Memory Limit: 512 MBSubmit: 2435  Solved: 1011[Submit][Status][Discus ...

  2. AC日记——Paint Pearls hdu 5009

    Paint Pearls 思路: 离散化+dp+剪枝: dp是个n方的做法: 重要就在剪枝: 如果一个长度为n的区间,有大于根号n种颜色,还不如一个一个涂: 来,上代码: #include <c ...

  3. [UML] Use Case 是什么

    虽然每个人使用系统的场景有所差异,但是若用户的目标是相同的,则其场景会极为类似.那么这些类似的场景的集合就是类,这种类就称为Use Case.其实例就是场景

  4. [转载]python实现带验证码网站的自动登陆

        原文地址:python实现带验证码网站的自动登陆作者:TERRY-V 早听说用python做网络爬虫非常方便,正好这几天单位也有这样的需求,需要登陆XX网站下载部分文档,于是自己亲身试验了一番 ...

  5. Python的并发并行[2] -> 队列[0] -> queue 模块

    queue 模块 / queue Module 1 常量 / Constants Pass 2 函数 / Function Pass 3 类 / Class 3.1 Queue类 类实例化:queue ...

  6. HDU 5916: Harmonic Value Description

    题目描述 The harmonic value of the permutation $p_1,p_2,\cdots p_n$ is$$\sum_{i=1}^{n-1} gcd(p_i.p_{i+1} ...

  7. 【CodeForces 788B】奇妙的一笔画问题

    [pixiv] https://www.pixiv.net/member_illust.php?mode=medium&illust_id=61845295 题目大意 给定n个点m条边的无向图 ...

  8. 五. 面向对象高级特性1. Java内部类及其实例化

    在 Java 中,允许在一个类(或方法.语句块)的内部定义另一个类,称为内部类(Inner Class),有时也称为嵌套类(Nested Class). 内部类和外层封装它的类之间存在逻辑上的所属关系 ...

  9. 国内 docker 仓库镜像对比

    http://www.datastart.cn/tech/2016/09/28/docker-mirror.html

  10. c:foreach如何输出序号

    关键在于<c:forEach>的varStatus属性,具体代码如下: <table width="500" border="0" cells ...