FriendsOfCake / vagrant-chef

a vagrant installation with all the necessary chef cookbooks to run a basic cakephp application
120 stars 43 forks source link

www-data need to be owner of /var/log/nginx #62

Closed HarderWork closed 7 years ago

HarderWork commented 7 years ago

When creating custom sites under the vagrant/apps-folder, nginx is configured to generate and write to application specific access.log-files. Problem is that user www-data lacks rights to create files in /var/log/nginx

In my nginx error.log these kind of errors was thrown: 2017/07/07 08:29:17 [crit] 20437#20437: *14 open() "/var/log/nginx/calico-access.log" failed (13: Permission denied) while logging request, client: 192.168.13.1, server: ~^(?<sname>.+)\.dev, request: "GET /favicon.ico HTTP/1.1", host: "calico.dev", referrer: "http://www.calico.dev/"

I solved the problem with sudo chown -R www-data:adm /var/log/nginx

I guess the "correct" solution is to add something like this to cookbooks/nginx/recipes/server.rb directory '/var/log/nginx' do   | owner "www-data"   | group "www-data"   | end

josegonzalez commented 7 years ago

Mind filing a pull request?