【问题标题】:CentOS 6.4 + Nginx + uwsgi + (13: Permission denied) while connecting to upstreamCentOS 6.4 + Nginx + uwsgi + (13: Permission denied) 同时连接到上游
【发布时间】:2015-03-29 12:20:40
【问题描述】:

如标题中所述,我在 CentOS 6.4 中的 nginx + uwsgi 设置中遇到权限被拒绝错误。我已经以 root 身份运行 uwsgi。下面是我的配置文件。请注意,我已经将 mysite_nginx.conf 链接 (ln -s) 到 /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 中关注了与同一问题相关的答案,但它们都没有帮助。我缺少什么?做错了吗?

提前致谢!

【问题讨论】:

  • 感谢您的反馈。我不小心删除了 audit.log 的条目,但经过检查,与我的设置/请求无关。我应该将其设置为允许还是禁用它?
  • This 可能会有所帮助。

标签: nginx uwsgi centos6


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2016-08-14
    • 1970-01-01
    • 2016-06-06
    • 2015-10-22
    • 1970-01-01
    • 2014-07-19
    • 2022-01-03
    • 2021-11-08
    相关资源
    最近更新 更多