Today I was investigating an issue in one of my customer servers and found a permission denied error on the logs:
[crit] 26728#0: *547 open() "/var/lib/nginx/tmp/proxy/2/00/002" failed (13: Permission denied) while reading upstream, client: 79.xx.xx.xxx, server: my.server.com, request: "GET /upload_photo.php HTTP/1.1", upstream: "http://127.0.0.1:81/upload_photo.php", host: "my.server.com", referrer: "http://my.website.com/index.php"
What was the problem?
My customer wasn’t able to load an entire webpage of this website, it was loading but partially.
First, check out your Nginx error logs, in my case this is what I did:
tail -f /var/log/nginx/error_log
Then I saw the (13: Permission denied) while reading upstream error, and noticed that
/var/lib/nginx/tmp/proxy/2/00/0002 was having wrong permissions, along with all it’s parent folders. So, as this was a simple tmp proxy directory, I got rid of them and set the proper owner for the parent directories:
How did I fix the permission denied error?
/etc/nginx/nginx.conf to find worker user of nginx, now that you know the user (it should be apache, nobody or nginx), this is what I did in my case:
chown apache.nginx /var/lib/nginx/tmp/proxy -v rm /var/lib/nginx/tmp/proxy/* -R chmod 777 /var/lib/nginx/tmp -v
Restarted nginx and apache just in case, and all solved 😀
Popular search terms:
- nginx pm2 13: Permission denied
- (13: Permission denied) while connecting to upstream
- permission denied /var/lib/nginx/ nginx client_temp
- 13 permission denied nginx