Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been getting this error

2013/03/13 13:25:07 [crit] 49299#0: *38 rename() "/var/tmp/nginx/fastcgi_temp/6/00/0000000006" to "/var/cache/nginx/microcache/8/fd/c36e398490d9b70e3c98ba094d065fd8" failed (13: Permission denied) while reading upstream

I tried other informations in Nginx and SO forums like changing the owner of folder/file, deleting the microcache folder for Nginx to create new by itself, but nothing seems to work.

My Nginx config has www as user(owner, in FreeBSD) all these folders /var/tmp/nginx/fastcgi_temp/ and /var/cache/nginx/microcache/ has www as user(owner) and wheel as group.

To test it I even gave -R 777 to those above mentioned folders and restart nginx, but error.log still says same error. Can't even think of what might possibly be wrong here, any guidance would be appreciated.

share|improve this question
Great idea to willy-nilly set permissions across the board to 0777. Better install that machine from scratch now, it is probably mesed up beyond repair. – vonbrand Mar 29 '13 at 0:14
I know 0777 is not right thing, but 0777 was just for two folders under fastcgi_tmp and microcache to test, I changed it back to 766, if you read my answer below – Jhilke Dai Mar 29 '13 at 1:15
up vote 2 down vote accepted

I fixed this up with giving permission to its parent directories. /var/cache/nginx all had Read Only permissions, while /var/cache/nginx/microcache/ had All permissions, it worked only after I changed /var/ , /var/cache/ and /var/cache/nginx/ permission to 766. This is still weird but it works for me.

share|improve this answer
May have been SELinux messing things up, that's what just happened to me. – nmr Jun 1 at 20:58

I've had this error come up few times over last few days I've transitioned content from an old hardware server into AWS EC2 instance. To resolve, I've had to delete the /var/tmp/nginx/fastcgi_temp folder and restart nginx service. This recreates the fastcgi_temp folder and, at least for me, the problem went away after that.

share|improve this answer

I just had this exact thing happen to me, running Amazon Linux and Nginx built from source. I fixed it by setting directory permissions as follows (you'll note I've edited the directory listing to make it more obvious which permissions you need on which directories). Note that 777 didn't work, you need 755 and these owners.

drwxr-xr-x 21 root root   4096 Dec 19 06:58 /var

drwxr-xr-x  8 root root 4096 Dec 18 18:43 /var/cache

drwxr-xr-x  7 nginx root 4096 Dec 18 18:45 /var/cache/nginx

drwx------  2 nginx root 4096 Dec 31 02:47 /var/cache/nginx/client_temp
drwx------ 12 nginx root 4096 Dec 27 04:09 fastcgi_temp
drwx------  2 nginx root 4096 Dec 18 18:45 proxy_temp
drwx------  2 nginx root 4096 Dec 18 18:45 scgi_temp
drwx------  2 nginx root 4096 Dec 18 18:45 uwsgi_temp
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.