1

As mentioned in the title, I'm experiencing a permission denied error in my nginx + uwsgi setup in my CentOS 6.4. I'm running uwsgi as root already. Below are my configuration files. Take note that I've already linked (ln -s) the mysite_nginx.conf to /etc/nginx/sites-enabled/. Also I've already changed the owner of /home/user1/location/mysite to nginx user.

mysite_uwsgi.ini

#mysite_uwsgi.ini file
[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /home/user1/location/mysite/myapp
# Django wsgi file
module          = mysite.wsgi
# the virtualenv (full path)
home            = /home/user1/location/mysite

# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 4
# the socket (use the full path to be safe
socket          = /home/user1/location/mysite/myapp/myapp.sock
# ... with appropriate permissions - may be needed
chmod-socket    = 666
chown-socket    = nginx:nginx
# clear environment on exit
vacuum          = true

# other config options
uid = nginx
gid = nginx
processes = 4

mysite_nginx.conf

# mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream mysite {
 server unix:///home/user1/location/mysite/myapp/myapp.sock; se this first)
}

# configuration of the server
server {
  # the port your site will be served on
  listen      8082;
  # the domain name it will serve for
  server_name 192.168.X.X; # 
  charset     utf-8;

  # max upload size
  client_max_body_size 75M;   # adjust to taste

  # Django media
  location /media  {
    alias /home/user1/location/mysite/media;  
  }

  location /static {
    alias /home/user1/location/mysite/static; 
  }

I already followed the answers related to the same issue here in stackoverflow but none of them help. What am I lacking? doing wrong?

Thanks in advance!

jaysonpryde
  • 2,733
  • 11
  • 44
  • 61

1 Answers1

0

I had the same problem. the problem is because of selinux policies. you can find the solution in the following link, follow Option 2: Extend the httpd_t Domain Permissions instructions:

http://nginx.com/blog/nginx-se-linux-changes-upgrading-rhel-6-6/

Moeen M
  • 1,352
  • 1
  • 9
  • 10