0

When I'm trying to add magento 2 varnish.vcl file by creating a symbolic link, varnish service stop working with error permission denied, while if I use default varnish configuration file varnish works smooth.

My Stack is ubuntu 16.04, varnish 4.1

ls -al 

drwxr-xr-x  2 root root 4096 Mar 21 13:14 .
drwxr-xr-x 96 root root 4096 Mar 21 12:56 ..
lrwxrwxrwx  1 root root   44 Mar 21 13:14 default.vcl -> /var/www/bazaar/varnish.vcl
-rw-r--r--  1 root root 1225 Aug 22  2017 default.vcl_bak
-rw-r--r--  1 root root   37 Mar 21 12:56 secret

here is the status for varnish service

 ● varnish.service - Varnish HTTP accelerator
   Loaded: loaded (/lib/systemd/system/varnish.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/varnish.service.d
           └─customexec.conf
   Active: failed (Result: exit-code) since Wed 2018-03-21 13:59:08 UTC; 2s ago
     Docs: https://www.varnish-cache.org/docs/4.1/
           man:varnishd
  Process: 3093 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 (code=exited, status=2)
 Main PID: 3093 (code=exited, status=2)

Mar 21 13:59:08 bazaar systemd[1]: Stopped Varnish HTTP accelerator.
Mar 21 13:59:08 bazaar systemd[1]: Started Varnish HTTP accelerator.
Mar 21 13:59:08 bazaar varnishd[3093]: Error: Cannot read -f file (/etc/varnish/default.vcl): Permission denied
Mar 21 13:59:08 bazaar systemd[1]: varnish.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 21 13:59:08 bazaar systemd[1]: varnish.service: Unit entered failed state.
Mar 21 13:59:08 bazaar systemd[1]: varnish.service: Failed with result 'exit-code'.

my current user for nginx is bazaar

and permissions for varnish.vcl is as follow

-rw-r--r--  1 bazaar bazaar 7226 Mar 21 13:24 varnish.vcl

Any hint or help will be highly appreciated. Thanks.

Moeen Basra
  • 733
  • 4
  • 18

1 Answers1

0

It is likely that the user (vcache) does not have access to read in the parent directory(s) /var/www/bazaar.

Nino Walker
  • 2,742
  • 22
  • 30