태그 보관물: varnish

varnish

구성된 포트에서 니스 데몬이 수신 대기하지 않습니다 -s malloc,256m /lib/systemd/system/varnish.service : GNU

우분투 16.04에 니스를 설치하려고합니다.

아무도 작동하지 않는 여러 기사를 읽었습니다. 내가 읽은 것부터 우분투 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파일에 있으며, 내가 찾은 다른 온라인 리소스는 다른 곳에서 생각하게 만들었으므로 온라인 (오래된) 자습서를주의하십시오!



답변

시스템 서비스 정의에서 니스 시작 매개 변수도 변경해야합니다. ExecStart서비스 정의 파일에서 시작하는 행을 편집 할 수 있습니다.

sudo vi /lib/systemd/system/varnish.service

그러나이 파일을 수정하면 향후 패키지 업데이트에서 업데이트되지 않을 것이라는 단점이 있습니다. 또는 주석에서 제안한 것처럼 시스템화 된 드롭 인 파일을 생성 할 수 있는데, 이는 시스템 정의에 설정을 추가하는 선호되는 방법입니다.

# create the drop in directory
sudo mkdir /etc/systemd/system/varnish.service.d
# create the drop in file. The name is irrelevant, as long as it ends in .conf
sudo vi /etc/systemd/system/varnish.service.d/mysettings.conf

여기서 변경하려는 설정 만 추가하면됩니다. 그 밖의 모든 것은 기본 정의 파일에서로드됩니다.

예:

[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

기본 줄이므로 필요에 따라 변경하십시오.

그런 다음, systemctl에게 구성 파일을 다시로드하고 서비스를 다시 시작하도록 지시하십시오.

sudo systemctl daemon-reload
sudo service varnish restart

니스는 이제 포트 80에서 수신 대기해야합니다.


답변

드롭 인에 빈 ExecStart =가 있어야합니다. 그렇지 않으면 서비스 시작 오류가 발생합니다 (중복 된 ExecStart).

sudo mkdir /etc/systemd/system/varnish.service.d
sudo nano /etc/systemd/system/varnish.service.d/varnishd.conf

[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T <YOUR WEBSERVER IP>:8081 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m


답변