首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Varnish无法正常启动

Varnish无法正常启动
EN

Stack Overflow用户
提问于 2017-02-02 21:35:29
回答 2查看 182关注 0票数 1

我有一个问题,启动清漆。它总是以默认参数开始,但我希望varnish侦听端口80。似乎init-script不能正确运行varnish (start-stop-daemon),然后它会默认运行。如果我开始的话,我的daemon.log会给我清漆的源码。我使用最新的Debian版本8.7,使用apt-get install varnish安装它。如果我在没有初始化脚本的情况下启动-a : /usr/sbin/varnishd :80 -T本地主机:6082 -f /etc/ varnish /default.vcl -S /etc/varnish/secret -s malloc,256m (有效)

我的配置和日志:

代码语言:javascript
复制
/etc/varnish/default.vcl:
it's default, nothing changed

/etc/default/varnish:
DAEMON_OPTS="-a :80 \
         -T localhost:6082 \
         -f /etc/varnish/default.vcl \
         -S /etc/varnish/secret \
         -s malloc,256m"

Start Init-Script
root@albiorix:~# /etc/init.d/varnish start

/var/log/daemon.log:
Feb  2 13:57:13 albiorix systemd[1]: Starting Varnish HTTP accelerator...
Feb  2 13:57:13 albiorix varnishd[24822]: /* ---===### include/vcl.h ###===--- */
Feb  2 13:57:13 albiorix varnishd[24822]: /*
Feb  2 13:57:13 albiorix varnishd[24822]: * NB:  This file is machine generated, DO NOT EDIT!
Feb  2 13:57:13 albiorix varnishd[24822]: *
Feb  2 13:57:13 albiorix varnishd[24822]: * Edit and run generate.py instead
Feb  2 13:57:13 albiorix varnishd[24822]: */
Feb  2 13:57:13 albiorix varnishd[24822]: struct vrt_ctx;
Feb  2 13:57:13 albiorix varnishd[24822]: struct req;
Feb  2 13:57:13 albiorix varnishd[24822]: struct busyobj;
Feb  2 13:57:13 albiorix varnishd[24822]: struct ws;
Feb  2 13:57:13 albiorix varnishd[24822]: struct cli;
Feb  2 13:57:13 albiorix varnishd[24822]: struct worker;
Feb  2 13:57:13 albiorix varnishd[24822]: typedef int vcl_init_f(struct cli *);
Feb  2 13:57:13 albiorix varnishd[24822]: typedef void vcl_fini_f(struct cli *);
Feb  2 13:57:13 albiorix varnishd[24822]: typedef int vcl_func_f(const struct vrt_ctx *ctx);
Feb  2 13:57:13 albiorix varnishd[24822]: /* VCL Methods */
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_RECV#011#011#011(1U << 1)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_PIPE#011#011#011(1U << 2)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_PASS#011#011#011(1U << 3)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_HASH#011#011#011(1U << 4)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_PURGE#011#011#011(1U << 5)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_MISS#011#011#011(1U << 6)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_HIT#011#011#011(1U << 7)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_DELIVER#011#011#011(1U << 8)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_SYNTH#011#011#011(1U << 9)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_BACKEND_FETCH#011#011(1U << 10)
Feb  2 13:57:13 albiorix varnishd[24822]: #define VCL_MET_BACKEND_RESPONSE#011(1U << 11)
...
Feb  2 13:57:13 albiorix varnishd[24822]: static struct director#011*directors[2];
Feb  2 13:57:13 albiorix varnishd[24822]: const struct VCL_conf VCL_conf = {
Feb  2 13:57:13 albiorix varnishd[24822]: .magic = VCL_CONF_MAGIC,
Feb  2 13:57:13 albiorix varnishd[24822]: .init_vcl = VGC_Init,
Feb  2 13:57:13 albiorix varnishd[24822]: .fini_vcl = VGC_Fini,
Feb  2 13:57:13 albiorix varnishd[24822]: .ndirector = 2,
Feb  2 13:57:13 albiorix varnishd[24822]: .director = directors,
Feb  2 13:57:13 albiorix varnishd[24822]: .ref = VGC_ref,
Feb  2 13:57:13 albiorix varnishd[24822]: .nref = VGC_NREFS,
Feb  2 13:57:13 albiorix varnishd[24822]: .nsrc = 2,
Feb  2 13:57:13 albiorix varnishd[24822]: .srcname = srcname,
Feb  2 13:57:13 albiorix varnishd[24822]: .srcbody = srcbody,
Feb  2 13:57:13 albiorix varnishd[24822]: .recv_func = VGC_function_vcl_recv,
Feb  2 13:57:13 albiorix varnishd[24822]: .pipe_func = VGC_function_vcl_pipe,
Feb  2 13:57:13 albiorix varnishd[24822]: .pass_func = VGC_function_vcl_pass,
Feb  2 13:57:13 albiorix varnishd[24822]: .hash_func = VGC_function_vcl_hash,
Feb  2 13:57:13 albiorix varnishd[24822]: .purge_func = VGC_function_vcl_purge,
Feb  2 13:57:13 albiorix varnishd[24822]: .miss_func = VGC_function_vcl_miss,
Feb  2 13:57:13 albiorix varnishd[24822]: .hit_func = VGC_function_vcl_hit,
Feb  2 13:57:13 albiorix varnishd[24822]: .deliver_func = VGC_function_vcl_deliver,
Feb  2 13:57:13 albiorix varnishd[24822]: .synth_func = VGC_function_vcl_synth,
Feb  2 13:57:13 albiorix varnishd[24822]: .backend_fetch_func = VGC_function_vcl_backend_fetch,
Feb  2 13:57:13 albiorix varnishd[24822]: .backend_response_func = VGC_function_vcl_backend_response,
Feb  2 13:57:13 albiorix varnishd[24822]: .backend_error_func = VGC_function_vcl_backend_error,
Feb  2 13:57:13 albiorix varnishd[24822]: .init_func = VGC_function_vcl_init,
Feb  2 13:57:13 albiorix varnishd[24822]: .fini_func = VGC_function_vcl_fini,
Feb  2 13:57:13 albiorix varnishd[24822]: };
Feb  2 13:57:14 albiorix systemd[1]: Started Varnish HTTP accelerator.
(1177 lines)

processes (ps ax):
24351 ?        SLs    0:00 /usr/sbin/varnishd -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
24352 ?        Sl     0:00 /usr/sbin/varnishd -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

root@albiorix:~# varnishd -V
varnishd (varnish-4.0.2 revision bfe7cd1)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2014 Varnish Software AS

我希望你能帮助我,或者干脆告诉我为什么我的日志文件里有源码:-/。Thx到社区的Beneboy

附言:对不起,我的英语,我是德国人。所以如果可以,请用德语回答:-)。

EN

回答 2

Stack Overflow用户

发布于 2017-02-03 05:39:50

在debian 8中,不再将config /etc/default/varnish与systemd一起使用。

编辑此文件: /lib/systemd/system/varnish.service

重新加载systemd: systemctl守护进程-重新加载

重新启动varnish: systemd重新启动varnish.service

尽情享受

票数 1
EN

Stack Overflow用户

发布于 2017-02-06 17:28:25

thx Christophe :-)

我会更准确地读取文件中的信息:

代码语言:javascript
复制
Headerinfo in der /etc/default/varnish:
# Note: If systemd is installed, this file is obsolete and ignored.  You will
# need to copy /lib/systemd/system/varnish.service to /etc/systemd/system/ and
# edit that file.

:-/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42003632

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档