【发布时间】:2012-07-10 22:12:31
【问题描述】:
我尝试在 nginx 和 uwsgi 上配置 django,尝试访问 localhost 时遇到 502 bad gateway 错误
这是我的 /etc/ngingx/sites-available/默认文件
server {
server_name testapp1.com www.testapp1.com;
access_log /var/log/nginx/testapp1.com.access.log;
location / {
uwsgi_pass unix:///var/run/uwsgi/app/testapp1/socket;
include uwsgi_params;
}
}
这是我在 /etc/nginx/apps-available/ 中的 testapp1.ini 文件
[uwsgi]
thread=3
master=1
env = DJANGO_SETTINGS_MODULE=testapp1.settings
module = django.core.handlers.wsgi:WSGIHandler()
chdir = /home/paul/apps/testapp1
socket = /run/uwsgi/testapp1/socket
logto = /var/log/uwsgi/testapp1.log
这是 uwsgi.log 文件
2012 年 7 月 10 日星期二 21:49:38 - *** 开始 uWSGI 1.0.3-debian(32 位)
[2012 年 7 月 10 日星期二 21:49:38] *** 2012 年 7 月 10 日星期二 21:49:38 - 编译
版本:4.6.2 2012 年 2 月 20 日 10:06:16 Tue Jul 10 21:49:38
2012 - 当前工作目录:/Tue Jul 10 21:49:38 2012 - 写作
pidfile 到 /run/uwsgi/app/testapp1/pid 2012 年 7 月 10 日星期二 21:49:38 -
检测到的二进制路径:/usr/bin/uwsgi-core Tue Jul 10 21:49:38 2012 -
setgid() 至 2012 年 7 月 10 日星期二 21:49:38 至 33 日 - setuid() 至 2012 年 7 月 10 日星期二 33 日
2012 年 21:49:38 - 您的内存页面大小为 4096 字节,周二 7 月 10 日
2012 年 21:49:38 - uwsgi 套接字 0 绑定到 UNIX 地址
/run/uwsgi/app/testapp1/socket fd 5 Tue Jul 10 21:49:38 2012 - bind():
没有这样的文件或目录 [socket.c line 107]
我没有更改 nginx.conf 文件。
【问题讨论】:
-
请发布 nginx 日志。 nginx 很可能无法连接到 uWSGI。在这种情况下,要么使用端口,要么使用fix permissions。
-
这些套接字定义是否相同?