Varnish相关

来源:互联网 发布:平面地图绘制软件 编辑:程序博客网 时间:2024/05/15 00:53

一、安装问题解决(版本4.0.2)

**********************************   问题  1 **********************************
configure: error: Package requirements (libpcre) were not met:
No package 'libpcre' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables PCRE_CFLAGS
and PCRE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-------------------------------   解决方法 1  --------------------------------
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
**********************************   问题  2 **********************************
如果报错的话,即pcre问题
../../lib/libvarnishapi/.libs/libvarnishapi.so: undefined reference to `pcre_free_study'
collect2: ld returned 1 exit status
make[3]: *** [varnishadm] Error 1
-------------------------------   解决方法 2  --------------------------------
试着将pcre-devel删除
 yum erase pcre-devel
再手动编译pcre
如果 yum报python版本的错误则将安装的最新的python版本改回旧的
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
 
   No module named yum

**********************************   问题  3 **********************************
报 python-docutils 错误需要安装
http://sourceforge.net/projects/docutils/files/?source=navbar
-------------------------------   解决方法 3  --------------------------------
安装 python setup.py install
**********************************   问题  4 **********************************
Making all in libvmod_debug
make[3]: Entering directory `/root/soft/varnish-4.0.2/lib/libvmod_debug'
python2 ../../lib/libvcc/vmodtool.py --strict ../../lib/libvmod_debug/vmod.vcc
  File "../../lib/libvcc/vmodtool.py", line 746
    print("WARNING: %s:" % m, file=sys.stderr)
                                  ^
SyntaxError: invalid syntax
make[3]: *** [vcc_if.h] Error 1
make[3]: Leaving directory `/root/soft/varnish-4.0.2/lib/libvmod_debug'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/soft/varnish-4.0.2/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/soft/varnish-4.0.2'
make: *** [all] Error 2
-------------------------------   解决方法 4  --------------------------------
升级Python2.4.3 到Python2.6.6 

tar jxvf Python-2.6.6.tar.bz2

# cd Python-2.6.6

# ./configure

make && make install
2、更改系统默认版本
# mv /usr/bin/python /usr/bin/python.bak 
# ln -s /usr/local/bin/python2.6 /usr/bin/python
如果之前安装过python-docutils 需要重新再装一遍

二、ESI例子

1、设置缓存时间(设置HTTP头部)。

JSP例子

<%

        Date d = new Date();

 

        String modDate = d.toGMTString();

 

        String expDate ="Mon, 18 Aug 2014 09:42:08 GMT";//计算出来的业务过期时间、根据数据知道变更节点的可以由数据计算得到、缓存固定时间的可以写时间窗口计算时间

 

        response.setHeader("Last-Modified", modDate);

 

        response.setHeader("Expires", expDate);

 

        //response.setHeader("Cache-Control", "public");

 

        //response.setHeader("Pragma", "Pragma");

        %>

 

 

2、使用ESI

     include一个页面:<esi:include src="URI" alt="URI" onerror="continue" />

     其它标签参照   http://www.w3.org/TR/esi-lang

0 0
原创粉丝点击