gpt4 book ai didi

nginx - uWSGI nginx 错误 : connect() failed (111: Connection refused) while connecting to upstream

转载 作者:行者123 更新时间:2023-12-04 12:57:41 40 4
gpt4 key购买 nike

我在 nginx( http://52.xx.xx.xx/ )上访问我的 IP 时遇到 502 网关错误,日志只是这样说:

2015/09/18 13:03:37 [error] 32636#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: xx.xx.xx.xx, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "xx.xx.xx.xx"



我的 nginx.conf 文件

# the upstream component nginx needs to connect to
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8000; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name xx.xx.xx.xx; # substitute your machine's IP address or FQDN
charset utf-8;

access_log /home/ubuntu/test_django/nginx_access.log;
error_log /home/ubuntu/test_django/nginx_error.log;


# max upload size
client_max_body_size 75M; # adjust to taste

# Django media
location /media {
alias /home/ubuntu/test_django/static/media/; # your Django project's media files - amend as required
}

location /static {
alias /home/ubuntu/test_django/static/; # your Django project's static files - amend as required
}

# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/ubuntu/test_django/uwsgi_params; # the uwsgi_params file you installed
}
}

nginx.conf 文件有什么问题吗.....如果我使用默认 conf,那么它就可以工作。

最佳答案

我通过更改 uwsgi.ini 中的套接字配置解决了它
来自 socket = 127.0.0.1:3031 , 至 socket = :3031 .当我在一个 Docker 容器中运行 nginx 而在另一个容器中运行 uWSGI 时,我遇到了这个问题。如果你使用命令行来启动 uWSGI 然后做 uwsgi --socket :3031 .

希望这有助于在使用 Docker 部署 Django 应用程序期间遇到同样问题的人。

关于nginx - uWSGI nginx 错误 : connect() failed (111: Connection refused) while connecting to upstream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32653394/

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