I've configured nginx to run django site via socket:

fastcgi_pass unix:/tmp/django.socket;

now I'm (manually) running

./manage.py runfcgi socket=/tmp/django.socket

http request results in 502 bad gateway, and the error is following:

connect() to unix:/tmp/django.socket failed (13: Permission denied) while connecting to upstream,

what permissions should I set, to be able to restart django fcgi easily?

link|improve this question

80% accept rate
feedback

1 Answer

up vote 2 down vote accepted

Nginx is running under some user (on Debian it is usually www-data), you can check it by:

ps aux | grep nginx | grep worker

User will be in the first column.

This user have to have access to /tmp/django.socket for writing and reading. You can solve it by running django under the same user as nginx is running (i.e. www-data on Debian), or you have to add nginx user to the same group, as user, under which are you running django, and socket have to have permission to read and write for group.

The first solution is simplier and (for me) better.

link|improve this answer
thank you! just in case anyone is interested: gksudo -u www-data ./manage.py runfcgi pidfile=/tmp/django.pid socket=/tmp/django.socket – migajek Jan 3 at 19:21
feedback

Your Answer

 
or
required, but never shown

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