squid cache 服务器端的安装,配置
一,什么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 服务器端的安装,配置的更多相关文章
- FastDFS_v5.05+nginx+cache集群安装配置手册
转载请出自出处:http://www.cnblogs.com/hd3013779515/ 1.FastDFS简单介绍 FastDFS是由淘宝的余庆先生所开发,是一个轻量级.高性能的开源分布式文件系统, ...
- RHEL7-openldap安装配置二(客户端安装配置)
LDAP用户登录流程: 当在客户端输入账号登录系统时,系统根据/etc/nsswitch.conf配置文件获取账号查找顺序,然后再根据PAM配置文件调用相关模块,对账号(/etc/passwd)及密码 ...
- Memcached&PHP-Memcache安装配置
参考文档: memcache官网:https://memcached.org/ 参考:http://www.runoob.com/memcached/memcached-install.html 参考 ...
- centos5.5用phpstudy一键安装配置虚拟主机后,yum配置代理服务器squid
最近因为工作需要,开发站点需要在lamp环境下跑网站,于是在win7上跑虚拟机装了一个centos5.5的linux 并用集成环境配置了一个lamp环境,这里用的是phpstudy的一键安装包,并配置 ...
- Squid安装配置和使用
文:铁乐与猫 环境 centos 6.5 x64 安装 最简单的一种就是yum安装. yum install squid 版本 rpm -qa | grep squid squid-3.1.23-16 ...
- Linux环境下SVN服务器端的安装与配置
最近尝试了下在Linux(CentOS6.5)环境下安装与配置SVN服务器端,安装过程中碰到了一些问题,参看了网友们分享的一些心得,并通过自己实际的操作,最终安装与配置成功!总的来说网上的说法芸芸,大 ...
- RHEL7-openldap安装配置一(服务器端安装配置)
LDAP的术语:entry:一个单独的单元,使用DN(distinguish name)区别attribute:entry的属性,比如,如果entry是组织机构的话,那么它的属性包括地址,电话,传真号 ...
- SVN服务器端的安装和配置
第2章 SVN 的下载与安装 服务器端的安装和配置 所有的开发人员用自己的账号登录进来就可以拥有对仓库里面的所有文件的读和写的权限 创建用户
- squid安装配置
Squid做反向代理(192.168.1.69) squid.conf http_port 80 vhost vport visible_hostname pdd2.matrixcdn.net cac ...
随机推荐
- 处理下最近的file_id小写问题
update t_resource_info set FILE_ID = UPPER(FILE_ID);update t_resource_my_info set FILE_ID = UPPER(FI ...
- MSSQL纵列转横列
在工作中我们一般会遇到将纵列转横列的需求,具体代码: 1.建表 CREATE TABLE [dbo].[AcrossChangeEndLong]( ,) NOT NULL, ) NOT NULL, ) ...
- Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon【暴力/数学/只有偶数才能分解为两个偶数】
time limit per test 1 second memory limit per test 64 megabytes input standard input output standard ...
- java标识符与命名规则
标识符就是给变量.类或方法起的名字.可以用字母.下划线或美元符号开头,区分大小写,没有最大长度限制.(关键字除外) 关键字 访问控制 private protected public ...
- Jmeter实时性能测试数据的监控
Jmetet实时性能测试数据的监控和展示Jmeter Grafana InfluxDB 安装Grafana配置jmeter安装InfluxDB配置Grafana展示数据一安装InfluxDB 为了方便 ...
- elasticsearch5.3.0 安装
公司有项目打算用elasticsearch,所以研究了下,目前最新版本5.3.0 安装 1.下载包 https://artifacts.elastic.co/downloads/elasticsea ...
- UIPanGestureRecognizer判断滑动的方向
.h文件 CGFloat const gestureMinimumTranslation = 20.0 ; typedef enum : NSInteger { kCameraMoveDirectio ...
- SQL Server 2005 系统数据介绍:dm_exec_connections
原文:SQL Server 2005 系统数据介绍:dm_exec_connections 转载:http://msdn.microsoft.com/zh-cn/library/ms181509(SQ ...
- Matlab中find函数陷阱
a = [ 1 2 3 3 3]; 如果a==3 返回[ 0 0 1 1 1]; find(a==3) 返回[3 4 5],这才是想要的下标.
- DotnetBrowser高级教程-(5)使用内置的MVC UI框架-EasyMvc
如果DotnetBrowser只是实现了内置chrome浏览器和web/web socket server,似乎还不是很完美.因此,最新的DotnetBrowser已经内置对easy mvc控件的支持 ...