503(Backend Fetch Failed后端获取失败)
如果Magento2缓存标签使用长度超过8192个字符,你可以看到HTTP 503(后台读取失败)在浏览器中的错误。这些错误可能显示如下:
Error 503 Backend fetch failed
Backend fetch failed
为了解决这个问题,修改varnish配置文件如下:
-
用
root
用户打开:- CentOS 6:
/etc/sysconfig/varnish
- CentOS 7:
/etc/varnish/varnish.params
- Ubuntu:
/etc/default/varnish
- CentOS 6:
- 搜索
http_resp_hdr_len
参数. - 如果参数不存在增加
thread_pool_max
. -
设置
http_resp_hdr_len
示例:
-p http_resp_hdr_len=64000 \
代码片段:
# DAEMON_OPTS is used by the init script. DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ -f ${VARNISH_VCL_CONF} \ -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ -p thread_pool_min=${VARNISH_MIN_THREADS} \ -p thread_pool_max=${VARNISH_MAX_THREADS} \ -p http_resp_hdr_len=64000 \ -S ${VARNISH_SECRET_FILE} \ -s ${VARNISH_STORAGE}"