首页 文章

Nginx - 4021#0 - 设置问题

提问于
浏览
1
  • 我正在使用Ubuntu 12.04.3 LTS的虚拟机

  • 我正在与Uwsgi nginx做一个Django项目

  • 我在我的hosts文件中添加了"192.168.33.50 myproject.com"

  • 我开始使用uwsgi主管nginx进程

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

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


第1版
这是我的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真空


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

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

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


第3版

这是/etc/nginx/conf.d/中的myproject.conf

server {listen 80; charset utf-8; sendfile off; #ONIX文件
client_max_body_size 100M;

location / media / imagen {
包括uwsgi_params;
#the uwsgi_pass必须遵守supervisord.conf中的详细信息
uwsgi_pass unix:/tmp/uwsgi_myproject.sock;
}

location / media / resources / protected {
root / vagrant / myproject / myproject;
内部;
}

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

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

地点 / {
包括uwsgi_params;
#the uwsgi_pass必须遵守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

1 回答

  • 1

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

相关问题