gpt4 book ai didi

nginx - 在正常信号下,nginx 在尝试连接到 uWSGI 套接字时抛出连接被拒绝

转载 作者:行者123 更新时间:2023-12-04 11:56:46 28 4
gpt4 key购买 nike

这个问题让我很困惑,因为我似乎正在关注文档中的所有内容,以便正常重启。

我在Emperor模式下运行uWSGI,有一堆附庸。当我尝试优雅地重启其中一个 vassal 时,我收到一个 nginx 502 Bad Gateway半秒左右的 react 。以下是一些信息:

我的 vassal .ini 文件之一:

[uwsgi]
master = true
processes = 2
home = /var/www/.virtualenvs/www.mysite.com
socket = /tmp/uwsgi.sock.myapp
pidfile = /tmp/uwsgi.pid.myapp
module = myapp
pythonpath = /var/www/www.mysite.com/mysite
logto = /var/log/uwsgi/myapp.log
chmod-socket = 666
vacuum = true
gid = www-data
uid = www-data

然后,我想优雅地重新启动这个过程:
kill -HUP `cat /tmp/uwsgi.pid.myapp`

vassal 日志文件的输出看起来不错(我认为?)
...gracefully killing workers...
Gracefully killing worker 1 (pid: 29957)...
Gracefully killing worker 2 (pid: 29958)...
binary reloading uWSGI...
chdir() to /var/www/www.mysite.com/vassals
closing all non-uwsgi socket fds > 2 (max_fd = 1024)...
found fd 3 mapped to socket 0 (/tmp/uwsgi.sock.kilroy)
running /var/www/.virtualenvs/www.mysite.com/bin/uwsgi
*** has_emperor mode detected (fd: 15) ***
[uWSGI] getting INI configuration from kilroy.ini
open("/var/log/uwsgi/kilroy.log"): Permission denied [utils.c line 250]
unlink(): Operation not permitted [uwsgi.c line 998]
*** Starting uWSGI 1.2.3 (64bit) on [Fri Jun 8 09:15:10 2012] ***
compiled with version: 4.6.3 on 01 June 2012 09:56:19
detected number of CPU cores: 2
current working directory: /var/www/www.mysite.com/vassals
writing pidfile to /tmp/uwsgi.pid.kilroy
detected binary path: /var/www/.virtualenvs/www.mysite.com/bin/uwsgi
setgid() to 33
setuid() to 33
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock.kilroy fd 3
Python version: 2.7.3 (default, Apr 20 2012, 23:04:22) [GCC 4.6.3]
Set PythonHome to /var/www/.virtualenvs/www.mysite.com
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x19e3e90
your server socket listen backlog is limited to 100 connections
*** Operational MODE: preforking ***
added /var/www/www.mysite.com/gapadventures/ to pythonpath.
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x19e3e90 pid: 30041 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 30041)
spawned uWSGI worker 1 (pid: 30042, cores: 1)
spawned uWSGI worker 2 (pid: 30043, cores: 1)

但是当我在此之后尝试快速访问该站点时,我的 nginx 日志得到以下结果:
2012/06/08 09:44:43 [error] 5885#0: *873 connect() to unix:///tmp/uwsgi.sock.kilroy failed (111: Connection refused) while connecting to upstream, client: 10.100.50.137, server: mydomain.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.sock.kilroy:", host: "mydomain.com"

这发生在发送信号后大约半秒钟,所以这显然不是很优雅。

有什么建议吗?非常感谢!

最佳答案

正确的 nginx 配置和 uWSGI 中的套接字路径。 Sockt 必须相同

曾是

unix:///tmp/uwsgi.sock.kilroy

或者
/tmp/uwsgi.sock.myapp

需要:

nginx
unix:/tmp/uwsgi.sock.myapp



uwsgi
socket = /tmp/uwsgi.sock.myapp

关于nginx - 在正常信号下,nginx 在尝试连接到 uWSGI 套接字时抛出连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10950229/

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