我想在Ubuntu 16.04上安装清漆,
我读了几篇文章没有工作。 从我读的,从Ubuntu 15.04以来,configuration清漆的方式已经改变(因为systemd)。
现在我有一个真正的混乱,这是行不通的:
/ etc / default / varnish:
DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m"
/etc/varnish/default.vcl(通常指向一个主机指向127.0.0和端口8080,但为了debugging的目的,我将其修改为一个外部域)vcl 4.0;
# Default backend definition. Set this to point to your content server. backend default { .host = "www.varnish-cache.org"; .port = "80"; }
/etc/apache2/ports.conf
Listen 8080
grep -R 'ExecStart=/usr/sbin/varnishd' /etc/
/etc/systemd/system/varnish.service:ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m /etc/systemd/system/varnish.service.d/customexec.conf:ExecStart=/usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m /etc/systemd/system/multi-user.target.wants/varnish.service:ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
/lib/systemd/system/varnish.service:
GNU nano 2.5.3 Fichier : /lib/systemd/system/varnish.service [Unit] Description=Varnish HTTP accelerator Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd [Service] Type=simple LimitNOFILE=131072 LimitMEMLOCK=82000 ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m ExecReload=/usr/share/varnish/reload-vcl ProtectSystem=full ProtectHome=true PrivateTmp=true PrivateDevices=true [Install] WantedBy=multi-user.target
service --status-all | grep varnish
[ - ] varnish [ + ] varnishlog [ + ] varnishncsa
之后
sudo service varnish stop sudo service varnish start
清漆服务没有监听http://127.0.0.1:80/ ,在重新启动之前,它监听http://127.0.0.1:6081/但它不工作了…我不知道该怎么做更多…
如果我这样做: systemctl status varnish
● varnish.service - Varnish HTTP accelerator Loaded: loaded (/etc/systemd/system/varnish.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/varnish.service.d └─customexec.conf Active: inactive (dead) since jeu. 2017-01-05 14:48:09 CET; 1s ago Docs: https://www.varnish-cache.org/docs/4.1/ man:varnishd Process: 5077 ExecStart=/usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m (code=exited, status=0/SUCCESS) Main PID: 5077 (code=exited, status=0/SUCCESS) janv. 05 14:48:09 xubuntu-16 systemd[1]: Started Varnish HTTP accelerator.
service --status-all | grep varnish
[ - ] varnish [ - ] varnishlog [ - ] varnishncsa
如果我sudo: varnishd -d -f /etc/varnish/default.vcl ,然后start ,一切工作正常…直到我退出cli
sudo apt remove varnish sudo apt-get purge varnish # I manually remove the 3 files in created in /etc/systemd/system/* sudo apt install varnish sudo nano /lib/systemd/system/varnish.service # put the rigth conf sudo nano /etc/varnish/default.vcl #put the rigth conf sudo systemctl daemon-reload sudo service varnish restart
一切正常! 神奇的是在/lib/systemd/system/varnish.service文件中,我发现的其他在线资源让我觉得它在别处,所以要小心在线(过时的)教程!
您还需要更改systemd服务定义中的清漆开始参数:
sudo vi /lib/systemd/system/varnish.service
更改以ExecStart开头的行以反映您的更改。 之后运行
systemctl daemon-reload sudo service varnish restart
清漆现在应该听港口80。