在生产中从 SQLite 切换到 Mysql 会导致错误

在生产中从 SQLite 切换到 Mysql 会导致错误

我正在使用数字海洋服务器。从 sqlite 切换到 mysql 数据库后,我得到了502 Bad Gateway nginx/1.18.0 (Ubuntu)

当我使用 从终端运行项目时,它运行良好python manage.py runserver ip:8000。我认为 gunicorn 存在故障。

有什么办法可以解决这个问题吗?

检查日志后,

sudo tail -F /var/log/nginx/error.log


2021/12/06 10:32:06 [error] 230230#230230: *15355 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:37:21 [error] 230230#230230: *15358 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:37:24 [error] 230230#230230: *15358 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:44:06 [error] 230230#230230: *15365 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:48:35 [error] 230230#230230: *15368 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:49:10 [notice] 1347821#1347821: signal process started
2021/12/06 10:49:15 [error] 1347822#1347822: *15371 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:51:10 [error] 1347822#1347822: *15374 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 10:56:54 [error] 1347822#1347822: *15377 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"
2021/12/06 11:00:09 [error] 1347822#1347822: *15381 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 113.199.220.31, server: develop-330.gsa-cs.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "develop-330.gsa-cs.com"

相关内容