权限被拒绝 - nginx和uwsgi套接字 [英] Permission denied - nginx and uwsgi socket

查看:1603
本文介绍了权限被拒绝 - nginx和uwsgi套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,我目前正试图使用​​nginx和uwsgi来获取我的django应用程序。我目前正在使用安装uwsgi的虚拟环境。但是,当尝试访问该页面时,我目前正在收到一个502网关错误。



我遇到的错误。

  2014/02/27 14:20:48 [crit] 29947#0:* 20 connect()到unix:///tmp/uwsgi.sock failed(13:Permission拒绝),同时连接到上游,客户端:144.136.65.176,服务器:domainname.com.au,请求:GET /favicon.ico HTTP / 1.1,上游:uwsgi:// unix:/// tmp / uwsgi。 sock:,host:www.domainname.com.au

这是我的nginx.conf

 #mysite_nginx.conf 

#上游组件nginx需要连接到
上游django {
server unix:///tmp/uwsgi.sock; #用于文件套接字
#server 127.0.0.1:8001; #对于一个web端口套接字(我们将使用这个)
}

#配置服务器
server {
#你的网站将被提供的端口在
听80;
#将为
提供的域名server_name .domainname.com.au; #替换你的机器的IP地址或FQDN
字符集utf-8;

#max上传大小
client_max_body_size 75M; #调整品味

#Django media
location / media {
alias / home / deepc / media; #你的Django项目的媒体文件 - 根据需要修改
}

location / static {
alias / home / deepc / static; #你的Django项目的静态文件 - 根据需要修改
}

#最后,将所有非媒体请求发送到Django服务器。
location / {
uwsgi_pass django;
包含/home/deepc/.virtualenvs/dcwebproj/dcweb/uwsgi_params; #你安装的uwsgi_params文件
}
}

这是我的uwsgi。 ini文件

  [uwsgi] 
socket = / tmp / uwsgi.sock
chmod-socket = 644
uid = www-data
gid = www-data

chdir = / home / deepc / .virtualenvs / dcwebproj / dcweb
module = dcweb.wsgi:application
pidfile = / home / deepc / .virtualenvs / dcwebproj / dcweb.pid
vacuum = true

从我在谷歌上阅读的与www-data group和/ tmp /目录有权限的问题。但是我是新的,并尝试改变该文件夹的权限级别无效。有人可以指出我的方向正确吗?这是一个权限问题。



也可以将sock文件放在tmp目录中吗?



感谢

解决方案

我想你只需要将套接字文件更改为666(664可以用www-data),或删除再次运行uwsgi服务器。



在我的uwsgi.ini中:

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


Well I am currently trying to get my django application served using nginx and uwsgi. I am currently using a virtual environment to which uwsgi is installed. However I am currently getting a 502 bad gateway error when attempting to access the page.

The Error I am experiencing.

2014/02/27 14:20:48 [crit] 29947#0: *20 connect() to unix:///tmp/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: 144.136.65.176, server: domainname.com.au, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.sock:", host: "www.domainname.com.au"

This is my nginx.conf

    # mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    server unix:///tmp/uwsgi.sock; # for a file socket
    #server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      80;
    # the domain name it will serve for
    server_name .domainname.com.au; # substitute your machine's IP address or FQDN
    charset     utf-8;

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

    # Django media
    location /media  {
        alias /home/deepc/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /home/deepc/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /home/deepc/.virtualenvs/dcwebproj/dcweb/uwsgi_params; # the uwsgi_params file you installed
    }
}

Here is my uwsgi.ini file

[uwsgi]
socket=/tmp/uwsgi.sock
chmod-socket=644
uid = www-data
gid = www-data

chdir=/home/deepc/.virtualenvs/dcwebproj/dcweb
module=dcweb.wsgi:application
pidfile=/home/deepc/.virtualenvs/dcwebproj/dcweb.pid
vacuum=true

From what i have read on google its a permissions problem with the www-data group and /tmp/ directory. However I am new to this and have tried to changer the permission level of the folder to no avail. Could someone point me in the right direction? Is this a permissions problem.

Also is it ok practice to put the sock file in tmp directory?

Thanks

解决方案

I think you just need to change your socket file to 666(664 is ok with www-data), or remove it and run uwsgi server again.

In my uwsgi.ini:

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

这篇关于权限被拒绝 - nginx和uwsgi套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆