nginx+gunicorn+daphne+supervisor部署, connection refused
来源:12-13 Nginx Gunicorn Daphne部署Django Channels应用
慕的地1451657
2019-07-24
老师我用了你给的nginx.conf仍然报 connection refused的错误
nginx error log 如下所示
2019/07/23 19:22:07 [error] 3387#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 85.163.87.21, server: _, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:9000/”, host: "35.245.90.218:80"
2019/07/23 20:44:51 [error] 3387#0: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 185.211.69.255, server: _, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:9000/”, host: "35.245.90.218:80"
2019/07/23 21:51:12 [error] 3388#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 77.45.5.187, server: _, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:9000/”, host: "35.245.90.218:80"
2019/07/23 22:42:35 [error] 3387#0: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 209.17.96.26, server: _, request: “GET / HTTP/1.0”, upstream: "http://127.0.0.1:9000/"
2019/07/23 23:50:18 [error] 3388#0: *11 connect() failed (111: Connection refused) while connecting to upstream, client: 92.118.160.13, server: _, request: “GET / HTTP/1.0”, upstream: "http://127.0.0.1:9000/"
2019/07/23 23:51:04 [error] 3387#0: *14 connect() failed (111: Connection refused) while connecting to upstream, client: 66.168.194.111, server: _, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:9000/”, host: “35.245.90.218”
gunicorn log如下所示
daphne log如下所示
elasticsearch log 为空
celery log 如下所
nginx access 如下所示
85.163.87.21 - - [23/Jul/2019:19:22:07 +0000] “GET / HTTP/1.1” 502 3693 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7” "-"
66.240.205.34 - - [23/Jul/2019:19:28:49 +0000] “Gh0stàxœKS``˜ÃÀÀÀÄŒ@¼Q– H§•e&§*$&g+2”ö°00¬¨rc ‚`&ƒÇK7†ån9•n;„3¬èsch¨^Ï4’J—©‚ã0Ñh]&øΗSËA4L?2=áÄ’†@õ`T®¯]” 400 173 “-” “-” "-"
185.211.69.255 - - [23/Jul/2019:20:44:51 +0000] “GET / HTTP/1.1” 502 3693 “-” “Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36” "-"
77.45.5.187 - - [23/Jul/2019:21:51:12 +0000] “GET / HTTP/1.1” 502 3693 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7” "-"
172.104.242.173 - - [23/Jul/2019:22:30:34 +0000] “9ÍÃVŒ&Dz/·Àt–Câ” 400 173 “-” “-” "-"
209.17.96.26 - - [23/Jul/2019:22:42:35 +0000] “GET / HTTP/1.0” 502 3693 “-” “Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)” "-"
92.118.160.13 - - [23/Jul/2019:23:50:18 +0000] “GET / HTTP/1.0” 502 3693 “-” “NetSystemsResearch studies the availability of various services across the internet. Our website is netsystemsresearch.com” "-"
66.168.194.111 - - [23/Jul/2019:23:51:04 +0000] “GET / HTTP/1.1” 502 3693 “-” “-” "-"
209.17.96.90 - - [24/Jul/2019:02:52:57 +0000] “GET / HTTP/1.0” 400 3316 “-” “Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)” “-”
[root@instance-2 zihu_clone]#
老师能帮我看看哪里除了问题吗谢谢老师
1回答
-
Jack
2019-07-25
您好,问题描述得比较详细了。还想问下前端访问的时候报的什么错误状态码?
nginx error.log看出来,nginx转发了动态请求,只是gunicorn服务接收的时候有问题,nginx服务没问题
daphne celery日志都正常,不过你gunicorn中为啥是listening at http://0.0.0.0:9000,不是127.0.0.1:9000?
如果错误状态码是500的话,你可以把debug开启,manage.py runserver来访问,看代码报错在哪里
022019-07-25
相似问题