【问题标题】:No cache: Varnish age 0无缓存:清漆年龄 0
【发布时间】:2015-09-27 18:01:55
【问题描述】:

嗨,我在我的网络服务器上安装了 Varnish 4.0.3。

FreeBSD 10.2 amd64 阿帕奇24 php56 mysql56

好的,一切都好。 所有工作都很完美。

但我只有一个问题,我认为清漆缓存来自 cookie。

当我安装 varnish 时,他没有为我创建任何配置文件。 仅在 /usr/local/etc/rc.d/varnishd 中

这是在清漆中:

. /etc/rc.subr

name=varnishd
rcvar=varnishd_enable

load_rc_config ${name}

: ${varnishd_enable:=YES}
: ${varnishd_pidfile=/var/run/${name}.pid}
: ${varnishd_listen=:80}
: ${varnishd_admin=localhost:81}
: ${varnishd_backend=127.0.0.1:8080}
: ${varnishd_storage=file,/tmp,100M}
: ${varnishd_hash=classic,16383}
: ${varnishd_user=www}
: ${varnishd_group=www}

command="/usr/local/sbin/${name}"
pidfile="${varnishd_pidfile}"

if [ -n "${varnishd_config}" ] ; then
	: ${varnishd_flags:="-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -h ${varnishd_hash} -u ${varnishd_user} -g ${varnishd_group} ${varnishd_extra_flags}"}
else
	: ${varnishd_flags:="-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -h ${varnishd_hash} -u ${varnishd_user} -g ${varnishd_group} ${varnishd_extra_flags}"}
fi

unset varnishd_user
unset varnishd_group

run_rc_command "$1"

我配置完之后就配置好了。 但是年龄是0。

我的问题是如何阻止 cookie 缓存?我没有配置文件..什么都没有。

http://www.isvarnishworking.com/ 这是我的网站:http://pvpgamers.net/

【问题讨论】:

    标签: varnish


    【解决方案1】:

    你读过Varnish documentation吗?

    您可以从内置 VCL 开始您自己的配置。您可以在 /usr/local/share/doc/varnish/builtin.vcl 中找到它们(如果我错了,请参阅 pkg info -l varnish4 输出)。

    然后,将 varnishd_config="/path/to/your/configuration" 添加到 /etc/rc.conf(并重新启动 Varnish 或重新加载您的配置)。

    我的问题是如何阻止 cookie 缓存?

    Age: 0 表示页面没有被缓存(错过)。默认情况下,当有任何 cookie 时,Varnish 不会缓存:

    if (req.http.Authorization || req.http.Cookie) {
        /* Not cacheable by default */
        return (pass);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-29
      • 2016-05-11
      • 2012-04-03
      • 2016-05-25
      • 1970-01-01
      • 2014-04-07
      • 2013-03-21
      • 2012-09-10
      相关资源
      最近更新 更多