[unix:///tmp/uwsgi_dev.sock的连接失败(111:连接被拒绝),同时连接到上游

问题描述 投票:0回答:1

我正在使用uwsgi + Nginx通过下面的crontab命令运行Django应用程序

* * * * * /usr/local/bin/lockrun --lockfile /path/to/lock_file -- uwsgi --close-on-exec -s /path/to/socket_file --chdir /path/to/project/settings/folder/ --pp .. -w project_name.wsgi -C666 -p 3 -H /path/to/virtualenv/folder/ 1>> /path/to/log_file 2>> /path/to/error_log

但是nginx错误日志文件显示错误

* 83 connect()到unix:/// path / to / socket_file失败(111:连接被拒绝),同时连接到上游,客户端:xxx.xxx.xx.xxx,服务器:本地主机,请求:“ GET / auth / status / HTTP / 1.1”,上游:“ uwsgi:// unix:/// path / to / socket_file:”,主机:“ xx.xxx.xx.xxx”,引荐来源网址:“ http://xx.xxx.xx.xxx/

django nginx uwsgi
1个回答
0
投票

检查是否创建了.sock文件:

ls /path/to/socket_file

如果已创建,请检查权限:

ls -l /path/to/socket_file

检查套接字文件的创建位置,可能是由于chdir命令,它已在其他位置创建。

lsof | grep socket_file

如果可以,您可以共享ngnix配置详细信息吗?

使用文件来提供配置参数很简单,更好。示例uwsgi.ini文件

[uwsgi]

print = -------------------------------------------------
print = Hello UWSGI is ready to start...
print = -------------------------------------------------

# the base directory (full path)
chdir           = /path/to/chdir/

#Application's wsgi file/module
module          = wsgi:application

# process-related settings
master          = true
# maximum number of worker processes
processes       = 8

socket          = /path/to/myuwsgi.sock
pidfile         = /opt/uwsgi/mywsgi.pid
chmod-socket = 660
logto2 = /log/path/uwsgi.log

在uwsgi启动时应用这些,请执行

uwsgi --ini uwsgi.ini

或者,将日志定向到特定文件:

uwsgi <your other paramerters> --logto2 /log/path/uwsgi.log
© www.soinside.com 2019 - 2024. All rights reserved.