2016-09-07 5 views
0

방금 ​​우분투 16.04를 새로 설치했는데 Ubuntu 14.04에서 할 수있는 것처럼 사용자 지정 구성 파일로 작업 할 수 없습니다.Ubuntu 16의 Varnish는 사용자 정의 default.vcl 파일을 읽을 수 없습니다.

I have read/etc/default/varnish으로 변경되면 init.d 대신 systemd가 사용되므로 아무런 영향이 없습니다.

그래서 프로세스가 /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 :6081 -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 

가 지금은 사용자 정의 VCL과 default.vcl을 (이 내가 일하고 있어요 자식 저장소에) 교환하고자합니다. 그래서 -f /home/bozdoz/path/to/default.vcl을 가지고 ExecStart에서 줄을 변경, 나는 서비스 데몬을 다시로드하고 다시 시작한 후 다음과 같은 오류가 발생합니다 : 내가 니스 소유하는 사용자 정의 파일에 대한 권한을 변경 시도

>> sudo systemctl status varnish.service 
● varnish.service - Varnish HTTP accelerator 
    Loaded: loaded (/lib/systemd/system/varnish.service; enabled; vendor preset: enabled) 
    Active: failed (Result: exit-code) since Wed 2016-09-07 14:29:58 ADT; 5s ago 
    Docs: https://www.varnish-cache.org/docs/4.1/ 
      man:varnishd 
    Process: 7588 ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :6081 -T localhost:6082 -f /home/bozdoz/path/to/default.vcl 
Main PID: 7588 (code=exited, status=2) 

Sep 07 14:29:58 bozdoz-dell systemd[1]: Started Varnish HTTP accelerator. 
Sep 07 14:29:58 bozdoz-dell varnishd[7588]: Error: Cannot read -f file (/home/bozdoz/path/to/default.vcl) 

을, 또는 vcache,하지만 둘 다 작동하지 않습니다. 777 (테스트 목적으로 만) 권한을 열려고 시도했지만 여전히 실패했습니다.

또한 사용자 지정 파일을 /etc/varnish/default.vcl에 복사하면 바니시가 완벽하게 작동합니다. 문제는 파일을 git 저장소에 저장하고 싶지만 바니시 서비스가 사용자 정의 파일에 액세스 할 수없는 것입니다.

systemd를 사용하여 다른 디렉토리의 사용자 정의 파일을 어떻게 사용할 수 있습니까?

답변

1

/home/bozdoz 또는 /home/bozdozdefault.vcl 사이의 중간 디렉터리 중 하나에 대한 사용 권한이 사용자에게이 사용 권한 거부 오류를 부여하는 것으로 의심됩니다.

더 일반적인 제안을 할 수 있다면 /lib/systemd/system에서 서비스 파일을 수정하는 것은 바람직하지 않습니다. Varnish 패키지가 업데이트되면 잠재적으로 변경 사항을 덮어 쓸 수 있습니다. /etc/systemd/system/varnish.service

  1. 복사 /lib/systemd/system/varnish.service

override.conf이 보일 것입니다 거기 델타를 대신

  • 디렉토리를 만들고 /etc/systemd/system/varnish.service.d/override.conf 파일이 변경하고 적용하는 대신, 당신은 두 가지 옵션이 있습니다 이렇게 :

    ExecStart= 
    ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :6081 -T localhost:6082 -f /home/bozdoz/path/to/default.vcl -S /etc/varnish/secret -s malloc,256m 
    

    첫 번째 문은 기존 ExecStart 지시문을 지우고 두 번째 명령문은 새로운 지시문을 설정합니다.

  • +0

    여전히 권한과 관련된 문제를 해결할 수 없습니다. 변경할 필요가있을 때마다 repo의 default.vcl 파일을/etc/varnish 디렉토리로 복사 할 수 있습니다. 사용자 정의 파일을 사용할 수없는 경우 가장 좋은 방법입니다. – bozdoz