AbdolHosein
AbdolHosein

Reputation: 558

Permission denied issue on uWSGI

I have setup a django-based project on an Ubuntu 13.04 Server. I could run this project with 'root' priviledges on uWSGI configuration file. But when I try to run this with standard 'www-data' user I got:

chdir(): Permission denied [uwsgi.c line 1851] 

I have changed ownership of my project and its appropriate virtualenv folder to 'www-data' but get this error again!

My uWSGI config file is something like this:

[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /root/my_project
# Django's wsgi file
module          = my_project.wsgi
# the virtualenv (full path)
home            = /root/.virtualenvs/my_project

# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe
socket          = unix:///root/my_project/server.uwsgi.sock

chmod-socket    = 666
uid     = www-data
gid     = www-data


# clear environment on exit
vacuum          = true

What's the wrong?

Upvotes: 1

Views: 2757

Answers (2)

Viktor
Viktor

Reputation: 1

This can be solved easily by adding a 0 (0www-data) before the user name.
If you don't care about safety, cause it grants root.

Upvotes: 0

Nikita
Nikita

Reputation: 6341

Your chdir, home, socket directives all use /root/ as their base, which is root user'svhome directory and therefore other users don't have access there. Also there might be some SELinux limitations.

Try to create a separate folder for your project, i.e. in /home/ (/home/www-data), make sure your www-data user has access to it and rights, and move your project and venv there, then change the settings (including socket) and try again.

Upvotes: 2

Related Questions