首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Django应用部署到Digitalocean 502 Bad Gateway

Django应用部署到Digitalocean 502 Bad Gateway
EN

Stack Overflow用户
提问于 2018-03-14 07:05:22
回答 1查看 387关注 0票数 0

我已经将我的django应用程序(在本地工作)复制到来自Digitalocean的一个水滴,在那里我安装了django 1-click应用程序。我得到了502 Bad Gateway,却无法理解其中的原因。

代码语言:javascript
复制
2018/03/13 22:25:06 [error] 2104#2104: *44 upstream prematurely closed connection while reading response header from upstream, client: 139.162.251.201, server: _, request: "GET / HTTP/1.0", upstream: "http://unix:/home/django/gunicorn.socket:/"
2018/03/13 22:28:19 [error] 2104#2104: *46 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 93.55.242.118, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "46.101.7.245"
2018/03/13 22:31:51 [error] 2104#2104: *49 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 93.55.242.118, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "46.101.7.245"
2018/03/13 22:32:05 [error] 2104#2104: *52 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: 93.55.242.118, server: _, request: "GET /admin HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/admin", host: "46.101.7.245"
2018/03/13 22:40:18 [error] 2104#2104: *55 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 93.55.242.118, server: _, request: "GET /admin HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/admin", host: "46.101.7.245"
2018/03/13 22:40:23 [error] 2104#2104: *55 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 93.55.242.118, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "46.101.7.245"
2018/03/13 22:44:08 [error] 2104#2104: *59 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 93.55.242.118, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "46.101.7.245"
2018/03/13 22:44:08 [error] 2104#2104: *62 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 93.55.242.118, server: _, request: "GET /robots.txt HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/robots.txt", host: "46.101.7.245"
2018/03/13 22:56:30 [error] 2104#2104: *64 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: 93.55.242.118, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "46.101.7.245"
2018/03/13 22:58:36 [error] 2104#2104: *67 connect() to unix:/home/django/gunicorn.socket failed (111: Connection refused) while connecting to upstream, client: 93.55.242.118, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "46.101.7.245"

我对Django和部署到服务器都是新手,我不能理解这个错误。我一直在寻找答案,但找不到适合我的解决方案。有没有办法获得更详细的错误信息?谢谢

EN

回答 1

Stack Overflow用户

发布于 2018-03-14 12:27:49

在你发布的日志中写着upstream: "http://unix:/home/django/gunicorn.socket:/" --看起来你的Nginx服务器配置错误,它无法连接到Django应用程序。

确保Nginx设置为连接到套接字(unix:/...)或http端点,Django应用程序在该端点上为流量提供服务。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49267271

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档