nginx suddenly starts to throw permission denied to /var/lib/nginx

Viewed 5837

I have a nginx server, it works fine about 1 year but two weeks ago server has been moved to another provider. All was ok, but after some time, aapproximatelly 3 days, server start to throw errors on upload files, like:

2017/07/26 09:58:18 [crit] 13254#13254: *2829396 open() "/var/lib/nginx/proxy/7/12/0000002127" failed (13: Permission denied) while reading upstream, client: 195.82.157.12, server: ***, request: "GET *** HTTP/1.0", upstream: "***", host: "***", referrer: "***"

but this is wrong, i even change permissions to 777 for shure, but there was still the same errors.

No other errors was in logs, only "permission denied" with different digital names after /var/lib/nginx/proxy/. After restarting nginx all was ok again, but now this errors returns with random interval, about 2 days. The only cure i found is restart.

Can anyone help me or at least give a clue were should I dig to fix this?

4 Answers

give permissions to /var/lib/nginx/ using this command :

chown -R www-data:www-data /var/lib/nginx/

this worked for me.

As for why this suddenly started happening for you, I presume it is because NGINX only drops files there when they are greater than 9K. Perhaps you were dealing with smaller or equal sized files previously.

Try this: change nginx proxy_temp_path to /tmp, edit your proxy config file, add:

proxy_temp_path /tmp;

and restart nginx.

Related