1

-I'm using a virtual machine with Ubuntu 12.04.3 LTS
-I'm doing a Django project with Uwsgi + nginx
-I added "192.168.33.50 myproject.com" to my hosts file
-I started uwsgi + supervisor + nginx process

-When I'm trying to access to myproject.com, I'm getting this error in /var/log/nginx/error.log:

2013/11/13 07:43:21 [crit] 14741#0: *1 connect() to unix:/tmp/uwsgi_myproject.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.33.1, s$


Edition 1
This is my uwsgi.ini:

[uwsgi]

module = myproject.wsgi:application

master workers = 3

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

auto-procname need-app vacuum


Edition 2
If I execute this command in console:

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

With that command, uwsgi starts and I can access to myproject.com but it's supossed that uwsgi starts with supervisor of django


Edition 3

This is myproject.conf in /etc/nginx/conf.d/

server { listen 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;
}

}


EDITED: ADDED SUPERVISOR.CONF ASKED BY @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
4

1 回答 1

1

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

于 2013-11-30T11:26:16.583 回答