连接到上游时CentOS 6.4 + Nginx + uwsgi +(13:权限被拒绝)

时间:2015-01-30 03:42:58

标签: nginx uwsgi centos6

正如标题中所提到的,我在CentOS 6.4中的nginx + uwsgi设置中遇到了权限被拒绝错误。我已经以root身份运行uwsgi了。以下是我的配置文件。请注意,我已经将(ln -s)mysite_nginx.conf链接到/ etc / nginx / sites-enabled /。此外,我已经将/ home / user1 / location / mysite的所有者更改为nginx用户。

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; 
  }

我已经在stackoverflow中跟踪了与此问题相关的答案,但没有一个有用。我缺少什么?做错了?

提前致谢!

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。问题是因为s​​elinux政策。您可以在以下链接中找到解决方案,请按照选项2:扩展httpd_t域权限说明进行操作:

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