web缓存值varnish使用
具体的介绍到官网 https://www.varnish-software.com/static/book
一、简介
Varnish is a reverse HTTP proxy, sometimes referred to as a HTTP accelerator or a web accelerator. It is designed for modern hardware, modern operating systems and modern work loads.
Varnish is designed for hardware that you buy today, not the hardware you bought 15 years ago. Varnish is designed to run on 64-bit architectures and will scale almost proportional to the number of CPU cores you have available. Though CPU-power is rarely a problem.
所以它是为64位操作系统打造的,服务于现在高性能的服务器。
Varnish does not keep track of whether your cache is on disk or in memory. Instead, Varnish will request a large chump of memory and leave it to the operating system to figure out where that memory really is. The operating system can generally do a better job than a user-space program.
它把一部分功能交给了处理能力更强的操作系统,由操作系统来维护缓存,这样系能更能提高
二、下载安装
wget http://repo.varnish-cache.org/source/varnish-3.0.4.tar.gz
tar -xzvf
./configure 报错 error: Package requirements (libpcre) were not met
但是我rpm -qa | grep pcre是有东西的
export PKG_CONFIG=/usr/local/lib/pkgconfig/还是不行,报错 The pkg-config script could not be found or is too old.
既然这么麻烦,我就不用PK_CONFIG了,
export PCRE_LIBS=/usr/lib64/
export PCRE_CFLAGS=/usr/lib64/
./configure --prefix=/usr/loca/varnish
但是make的时候出错 :undefined reference to `pcre_free
好吧,尼玛的我重新安装pkg-config
wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.27.1.tar.gz
tar -xzvf
./configure --with-libiconv=gnu
make && maike install
然后 调用./pkg-config又报错: error while loading shared libraries: libiconv.so.2:
libiconv.so.2在/usr/local/lib目录下
vim /etc/ld.so.conf,增加一行/usr/local/lib
ldconfig,再运行pkg-config就不报错了
再次进入varnish的安装目录,这次configure make make install都不报错了。尼玛的坑爹货。早知道这么麻烦我直接 yum install varnish一句搞定
三、运行
vim /usr/local/varnish/etc/varnish/default.把
backend default {
.host = "127.0.0.1";
.port = "8080";
}前面的注释去掉
chown www:www -R /usr/local/varnish/var/varnish/
/usr/local/varnish/sbin/varnishd -P /var/run/varnish.pid -a :80 -f /usr/local/varnish/etc/varnish/default.vcl -T 127.0.0.1:6082 -t 120 -w 50,1000,120 -u www -g www -s file,/usr/local/varnish/var/varnish/varnish_storage.bin,1G
四、配合nginx
1、把nginx监听的端口从80改成上面的8080
2、重启nginx服务,然后开启varnish服务即可
五、重启varnish
/usr/local/varnish/bin/varnishadm
vcl.load reload01 /usr/local/varnish/etc/varnish/default.vcl
vcl.use reload01
这样就重启了。更改了default.vcl以后可以这样简单的重新加载配置
六、一些配置
未完待续
七、一些小注意事项
1、如果http的请求中带有cookie,默认情况下varnish是不会缓存的。如果想对cookie做一些筛选,可以参照https://www.varnish-cache.org/trac/wiki/VCLExampleRemovingSomeCookies
web缓存值varnish使用的更多相关文章
- Web缓存(Varnish方案)
Web缓存(Varnish方案) 转载 http://www.s135.com/post/313/ arnish是一款高性能的开源HTTP加速器,挪威最大的在线报纸 Verdens Gang (htt ...
- 【Web缓存机制系列】2 – Web浏览器的缓存机制-(新鲜度 校验值)
Web缓存的工作原理 所有的缓存都是基于一套规则来帮助他们决定什么时候使用缓存中的副本提供服务(假设有副本可用的情况下,未被销毁回收或者未被删除修改).这些规则有的在协议中有定义(如HTTP协议1.0 ...
- 项目实战5—企业级缓存系统varnish应用与实战
企业级缓存系统varnish应用与实战 环境背景:随着公司业务快速发展,公司的电子商务平台已经聚集了很多的忠实粉丝,公司也拿到了投资,这时老板想通过一场类似双十一的活动,进行一场大的促销,届时会有非常 ...
- web缓存服务器varnish-4.1.6的部署及配置详解
web缓存服务器varnish-4.1.6的部署及配置详解 1.安装varnish4.1.6安装依赖 yum install -y autoconf automake jemalloc-devel l ...
- 作为前端应当了解的Web缓存知识
缓存优点 通常所说的Web缓存指的是可以自动保存常见http请求副本的http设备.对于前端开发者来说,浏览器充当了重要角色.除此外常见的还有各种各样的代理服务器也可以做缓存.当Web请求到达缓存时, ...
- Web缓存杂谈
一.概述 缓存通俗点,就是将已经得到的‘东东’存放在一个相对于自己而言,尽可能近的地方,以便下次需要时,不会再二笔地跑到起始点(很远的地方)去获取,而是就近解决,从而缩短时间和节约金钱(坐车要钱嘛). ...
- Web 技术人员需知的 Web 缓存知识(转)
最近的译文距今已有4年之久,原文有一定的更新.今天踩着前辈们的肩膀,再次把这篇文章翻译整理下.一来让自己对web缓存的理解更深刻些,二来让大家注意力稍稍转移下,不要整天HTML5, 面试题啊叨啊叨的~ ...
- [转载]WEB缓存技术概述
[原文地址]http://www.hbjjrb.com/Jishu/ASP/201110/319372.html 引言 WWW是互联网上最受欢迎的应用之一,其快速增长造成网络拥塞和服务器超载,导致客户 ...
- Web 技术人员需知的Web 缓存知识
最近的译文距今已有4年之久,原文有一定的更新.今天踩着前辈们的肩膀,再次把这篇文章翻译整理下.一来让自己对web缓存的理解更深刻些,二来让大家注意力稍稍转移下,不要整天HTML5, 面试题啊叨啊叨的~ ...
随机推荐
- html下select追加元素,IE下错误
var selectCtr=window.document.getElementById("lesson_up"); selectCtr.add(opt,selectCtr.opt ...
- 苹果开发者账号注册&真机调试
苹果公司开发者账号注册流程详解 http://www.cnblogs.com/xilinch/p/4037164.html 真机调试教程 http://segmentfault.com/a/11900 ...
- UNIX / Linux: 2 Ways to Add Swap Space Using dd, mkswap and swapon
UNIX / Linux: 2 Ways to Add Swap Space Using dd, mkswap and swapon by RAMESH NATARAJAN on AUGUST 18, ...
- Android无法访问本地服务器(localhost)的解决方案
在Android开发中通过localhost或127.0.0.1访问本地服务器时,会报java.net.ConnectException: localhost/127.0.0.1:8083 -Conn ...
- sql server 2008r2 清除数据库日志
USE [master] GO ALTER DATABASE data SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE data SET REC ...
- Linux 查找文件方法
1) find -name httpd.conf 2) find /etc -name "*repo" 详情查找命令-> http://www.yesky.com/210/1 ...
- int (*(*fp)(void *))[10]; 指向函数的指针类型
<pre lang="c" escaped="true">int (*(*fp)(void *))[10]; //这个类型用typedef分解出来 ...
- 删除github.com上repository(仓库)的方法
第一步:打开http://github.com,看到右侧仓库列表.第二步:假设要删除“HiTop”这个参考,点击对应仓库进入详细页面之后,在右侧会看到“Settings”入口. 第三步:进入设置页面之 ...
- 使用jQuery Mobile实现新闻浏览器(3)
在本教程的前两篇文章中,笔者分别向大家介绍了使用jQuery Mobile框架如何去设计手机新闻浏览器,其中实现了一个WEB版本的新闻浏览器,在本教程的最后一篇中,将讲解如何将已实现的web版本的新闻 ...
- reStructuredText
reStructuredText 简明教程 060724 17:58 作者: Laurence 邮箱: 2999am@gmail.com ID: Kardinal @ Ubuntu.org.cn论坛 ...