一会儿出现502,现在又开始出现504.可以访问8000端口,不能直接访问ip地址。

来源:17-7 uwsgi和nginx配置

慕侠3297407

2021-10-22

504 Gateway Time-out
nginx/1.20.1
502 Bad Gateway
nginx/1.20.1

spawned uWSGI worker 1 (and the only) (pid: 689, cores: 1)
[pid: 689|app: 0|req: 1/1] 39.72.50.95 () {38 vars in 819 bytes} [Fri Oct 22 15:43:58 2021] GET / => generated 3335 bytes in 27 msecs (HTTP/1.1 200) 3 headers in 110 bytes (1 switches on core 0)
[pid: 689|app: 0|req: 2/2] 39.72.50.95 () {38 vars in 736 bytes} [Fri Oct 22 15:43:59 2021] GET /static/js/carousel.js => generated 77 bytes in 1 msecs (HTTP/1.1 404) 3 headers in 100 bytes (1 switches on core 0)
[pid: 689|app: 0|req: 3/3] 39.72.50.95 () {40 vars in 937 bytes} [Fri Oct 22 15:43:59 2021] GET /media/product_image/2021/10/057333ed3c2f530d3486a6278c6d360.jpg => generated 0 bytes in 1 msecs (HTTP/1.1 304) 2 headers in 77 bytes (0 switches on core 0)
[pid: 689|app: 0|req: 4/4] 39.72.50.95 () {40 vars in 903 bytes} [Fri Oct 22 15:43:59 2021] GET /media/product_image/2021/10/xieliu_VVfdADJ.jpg => generated 0 bytes in 0 msecs (HTTP/1.1 304) 2 headers in 77 bytes (0 switches on core 0)
[pid: 689|app: 0|req: 5/5] 180.163.220.3 () {34 vars in 810 bytes} [Fri Oct 22 15:46:54 2021] GET /news/list => generated 1799 bytes in 6 msecs (HTTP/1.1 200) 3 headers in 110 bytes (1 switches on core 0)
[pid: 689|app: 0|req: 6/6] 180.163.220.67 () {40 vars in 897 bytes} [Fri Oct 22 15:46:59 2021] GET /news/list => generated 1799 bytes in 4 msecs (HTTP/1.1 200) 3 headers in 110 bytes (1 switches on core 0)
[pid: 689|app: 0|req: 7/7] 180.163.220.67 () {38 vars in 838 bytes} [Fri Oct 22 15:47:05 2021] GET /static/css/xinwen.css => generated 77 bytes in 0 msecs (HTTP/1.1 404) 3 headers in 100 bytes (1 switches on core 0)
[pid: 689|app: 0|req: 8/8] 39.72.50.95 () {40 vars in 843 bytes} [Fri Oct 22 15:54:48 2021] GET / => generated 3335 bytes in 4 msecs (HTTP/1.1 200) 3 headers in 110 bytes (1 switches on core 0)
[pid: 689|app: 0|req: 9/9] 39.72.50.95 () {40 vars in 806 bytes} [Fri Oct 22 15:54:48 2021] GET /static/js/carousel.js => generated 77 bytes in 0 msecs (HTTP/1.1 404) 3 headers in 100 bytes (1 switches on core 0)
[pid: 689|app: 0|req: 10/10] 39.72.50.95 () {42 vars in 911 bytes} [Fri Oct 22 15:54:48 2021] GET /media/product_image/2021/10/xieliu_VVfdADJ.jpg => generated 0 bytes in 0 msecs (HTTP/1.1 304) 2 headers in 77 bytes (0 switches on core 0)
[pid: 689|app: 0|req: 11/11] 39.72.50.95 () {42 vars in 945 bytes} [Fri Oct 22 15:54:48 2021] GET /media/product_image/2021/10/057333ed3c2f530d3486a6278c6d360.jpg => generated 0 bytes in 0 msecs (HTTP/1.1 304) 2 headers in 77 bytes (0 switches on core 0)

云服务器80端口也打开了。
允许 自定义 TCP
80/80 IPv4地址段访问

写回答

1回答

bobby

2021-10-23

只要出现504或者502就代表你的nginx配置没有问题不用排查这个,你现在要排查的是502和504的问题,如果出现502达标你的django项目有异常, 如果出现504代表你的django项目端口无法访问 是否没有启动? 通过ssh启动的uwsgi最好是在tmux中启动

0
3
bobby
回复
慕侠3297407
502的话就是wsgi启动的django有异常
2021-10-25
共3条回复

Django+ xadmin 开发在线教育网站

一套通用的技术组合拳,助你解决大部分Python类网站后端问题

1911 学习 · 2149 问题

查看课程