一,什么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. Netty源码学习(三)NioEventLoop

    0. NioEventLoop简介 NioEventLoop如同它的名字,它是一个无限循环(Loop),在循环中不断处理接收到的事件(Event) 在Reactor模型中,NioEventLoop就是 ...

  2. 使用webView的时候,出现Error loading page Domain:WebKitErrorDomain Error Code:101 Description: The URL can't be shown

    onShouldStartLoadWithRequest = (e) => {// Implement any custom loading logic here, don't forget t ...

  3. (10)java基础知识-字符串

    String s和 new String 的区别 String s1="hello"; String s2= new String("hello"); Stri ...

  4. Codeforces Round #428 A. Arya and Bran【模拟】

    A. Arya and Bran time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  5. Wannafly挑战赛10 D 小H的询问(线段树)

    题目链接  Problem D 这个题类似 SPOJ GSS3 做过那个题之后其实就可以秒掉这题了. 考虑当前线段树维护的结点 在那道题的基础上,这个题要多维护几个东西,大概就是左端点的奇偶性,右端点 ...

  6. Python的扩展接口[0] -> VISA仪器控制

    VISA仪器控制 / VISA Instrument Control 1 VISA简介 / VISA Introduction VISA(Virtual Instrument Software Arc ...

  7. Codeforces 1037F. Maximum Reduction

    总感觉我这种做法会T,一直没写,看了其他人的题解也是这样,,,就果断写了,,可能数据不太深,或者玄学复杂度 题意即求xk-1长度的所有区间的最大值的和,对每一个i(数组下边),他对答案的贡献数量就是在 ...

  8. jcl sort comp3 to 表示型

    Lets say your packed data is at 10th column and is of length 6, S9(4)V99 You could try the following ...

  9. Quaternion Euler

    geometry_msgs::Quaternion orientation = map->info.origin.orientation;      tf::Matrix3x3 mat(tf:: ...

  10. 「PKUWC 2018」随机算法 (60分部分分做法)

    明天就是CTSC的DAY 2了qwq,晚上敲敲暴力攒攒RP,果断随便看了个题就是打暴力hhhhh 前50% O(3^N) 暴力没什么好说的,我们设F[S][s]为已经选了S集合中的点,并且这个集合中的 ...