ฉันพยายามติดตั้งวานิชบน Ubuntu 16.04
ฉันอ่านบทความต่าง ๆ ที่ไม่มีการทำงาน จากสิ่งที่ฉันอ่านตั้งแต่ Ubuntu 15.04 วิธีการกำหนดค่าวานิชได้เปลี่ยนไป (เพราะ 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 แต่เพื่อจุดประสงค์ในการดีบักฉันแก้ไขมันเป็นโดเมนภายนอก) 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
แก้ไขแล้วขอบคุณ @Gerald Schneider ฉันโพสต์ขั้นตอนที่ฉันต้องทำ:
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ไฟล์แหล่งข้อมูลออนไลน์อื่น ๆ ที่ฉันพบทำให้ฉันคิดว่ามันอยู่ที่อื่นดังนั้นระวังบทเรียนออนไลน์ (ที่ล้าสมัย)!