gpt4 book ai didi

django - nginx + uwsgi + django出现502错误

转载 作者:行者123 更新时间:2023-12-04 04:44:53 25 4
gpt4 key购买 nike

我试图在nginx和uwsgi的最上面配置django,尝试访问localhost时遇到502错误的网关错误

这是我的/etc/ngingx/sites-available/default文件

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文件

Tue Jul 10 21:49:38 2012 - *** Starting uWSGI 1.0.3-debian (32bit) on
[Tue Jul 10 21:49:38 2012] *** Tue Jul 10 21:49:38 2012 - compiled
with version: 4.6.2 on 20 February 2012 10:06:16 Tue Jul 10 21:49:38
2012 - current working directory: / Tue Jul 10 21:49:38 2012 - writing
pidfile to /run/uwsgi/app/testapp1/pid Tue Jul 10 21:49:38 2012 -
detected binary path: /usr/bin/uwsgi-core Tue Jul 10 21:49:38 2012 -
setgid() to 33 Tue Jul 10 21:49:38 2012 - setuid() to 33 Tue Jul 10
21:49:38 2012 - your memory page size is 4096 bytes Tue Jul 10
21:49:38 2012 - uwsgi socket 0 bound to UNIX address
/run/uwsgi/app/testapp1/socket fd 5 Tue Jul 10 21:49:38 2012 - bind():
No such file or directory [socket.c line 107]



我没有更改nginx.conf文件。

最佳答案

错误消息很清楚:

Tue Jul 10 21:49:38 2012 - uwsgi socket 0 bound to UNIX address
/run/uwsgi/app/testapp1/socket fd 5
Tue Jul 10 21:49:38 2012 - bind():
No such file or directory [socket.c line 107]

您看到以下两者之间的区别了吗?
 socket = /run/uwsgi/testapp1/socket

和:
 uwsgi_pass unix:///var/run/uwsgi/app/testapp1/socket;



提示:/ var /run/uwsgi/ 应用程序/testapp1/socket

关于django - nginx + uwsgi + django出现502错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11430185/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com