flask+uwsgi+nginx部署的时候nginx请求到不了uwsgi
uwsgi配置:
[uwsgi]
module = blog.app:app
master = true
processes = 4
http=127.0.0.1:8000
chdir = /home/saberbin/project/blog
socket = /home/saberbin/project/blog/myproject.sock
logto = /home/saberbin/project/blog/log/uwsgi.log
chmod-socket = 660
vacuum = true
nginx配置
server {
listen 8080;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_read_timeout 240s;
}
}
测试的时候,访问uwsgi配置的8000端口可以正常访问,但是访问8080端口就返回504.
查了一下nginx的日志
2021/09/01 00:10:48 [error] 10662#10662: *13 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "127.0.0.1:8080", referrer: "http://127.0.0.1:8080/"
2021/09/01 00:11:41 [notice] 12862#12862: signal process started
2021/09/01 00:14:29 [error] 12863#12863: *20 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "127.0.0.1:8080"
2021/09/01 00:17:39 [notice] 14288#14288: signal process started
2021/09/01 00:18:49 [error] 14289#14289: *22 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "127.0.0.1:8080"
2021/09/01 10:00:56 [error] 28135#28135: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "127.0.0.1:8080"
请问这个是什么原因呢,怎么解决这个问题?谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论