如何设置清漆运行端口80./etc/default/varnish中的DAEMON_OPTS设置出现故障



我已经安装了清漆,并按照确切的说明进行了设置,但是,它不像预期的那样工作。

我的/etc/default/varnish设置是:

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

VLC设置

backend default {
    .host = "localhost";
    .port = "8080";
}

我的apache port.conf设置是:

NameVirtualHost 127.0.0.1:8080
Listen 127.0.0.1:8080
<IfModule ssl_module>
        Listen 443
</IfModule>
<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

我正在运行ubuntu 15.04和Apache 2.4.10。当我开始清漆并检查过程时,我得到以下内容:

0:00 /usr/sbin/varnishd -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

似乎侦听地址或管理接口都不像/etc/varnish/default.vcl中设置的那样工作。因此,我的所有虚拟机都无法工作。我怎么解决这个问题?

好的。问题解决了。首先做

sudo grep -R 'ExecStart=/usr/sbin/varnishd' /etc/

这样你就可以找到Varnish设置守护进程选项的其他地方(在我的例子中是/etc/systemd/system/multi-user.target.wants/Varnish .service)。在vim,nano或其他文件中打开文件,并在该文件中设置"ExecStart",如下所示:

-a :[same as /etc/default/varnish]80 -T localhost:[same as /etc/default/varnish]1234 -f [same as /etc/default/varnish ]/etc/varnish/default.vcl -S [same as /etc/default/varnish ]/etc/varnish/secret -s malloc,256m

保存并退出。之后:

systemctl daemon-reload
systemctl restart varnish.service

然后就做完了。没有什么比得上官方教程。

Full explanation of the problem here

您可以通过以下步骤将清漆默认端口更改为80:

  1. 打开路径:sudo vim /lib/systemd/system/varnish.service
  2. 更新默认值: ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T :6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
  3. 运行以下命令: sudo systemctl daemon-reload sudo service varnish restart

相关内容

最新更新