Nginx - 4021#0 - 设置问题

时间:2013-11-13 08:26:09

标签: django nginx uwsgi

- 我正在使用Ubuntu 12.04.3 LTS的虚拟机 - 我正在用Uwsgi + nginx做一个Django项目 - 我在我的主机文件中添加了“192.168.33.50 myproject.com” - 我开始使用uwsgi + supervisor + nginx进程

- 当我尝试访问myproject.com时,我在/var/log/nginx/error.log中收到此错误:

  

2013/11/13 07:43:21 [暴击] 14741#0:* 1 connect()到   unix:/tmp/uwsgi_myproject.sock失败(2:没有这样的文件或   目录)连接上游时,客户端:192.168.33.1,s $


第1版
这是我的uwsgi.ini:

  

[uwsgi]

     

module = myproject.wsgi:application

     

掌握工人= 3

     

logto = /vagrant/log/uwsgi.log
  socket = /tmp/uwsgi_myproject.sock
  pidfile = /tmp/uwsgi_myproject.pid chmod-socket = 666

     

auto-procname need-app vacuum


第2版
如果我在控制台中执行此命令:

  

uwsgi --ini /vagrant/uwsgi.ini --chir / vagrant / myproject / --socket   /tmp/uwsgi_myproject.sock --pidfile /tmp/myproject.pid

使用该命令,uwsgi启动并且我可以访问myproject.com,但是它是suwssed uwsgi以django的主管开始


第3版

这是/etc/nginx/conf.d /

中的myproject.conf
  

服务器{       听80;       charset utf-8;       sendfile off;

# ONIX files
client_max_body_size 100M;

location /media/imagen {
    include     uwsgi_params;
    #The uwsgi_pass must comply with the details in supervisord.conf
    uwsgi_pass  unix:/tmp/uwsgi_myproject.sock;
}

location /media/resources/protected {
    root /vagrant/myproject/myproject;
    internal;
}

location /media  {
    root /vagrant/myproject/myproject;
}

location /static {
    root /vagrant/myproject/myproject;
}

location / {
    include     uwsgi_params;
    #The uwsgi_pass must comply with the details in supervisord.conf
    uwsgi_pass  unix:/tmp/uwsgi_myproject.sock;
  uwsgi_read_timeout  300;
}
     

}


已编辑:已加入SUPERVISOR.CONF由@ChrisC提出

[supervisord]
logfile={{ PROJECT_DIR }}/../log/supervisord.log
pidfile=/tmp/supervisor_PROJECTNAME.pid
user=PROJECTNAME
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8,LC_LANG=en_US.UTF-8

[unix_http_server]
file = /tmp/supervisor_PROJECTNAME.sock

[program:__defaults__]
directory={{ PROJECT_DIR }}
startsecs=5

[program:autoreload]
exclude=true

[program:uwsgi]
command=uwsgi --ini {{ PROJECT_DIR }}/../uwsgi.ini --chdir {{ PROJECT_DIR }} --socket /tmp/uwsgi_PROJECTNAME.sock --pidfile /tmp/uwsgi_PROJECTNAME.pid
stopsignal=INT

1 个答案:

答案 0 :(得分:1)

问题在于主管的配置。主管没有很好地加载uwsgi进程。