python - Python 服务器的问题
问题描述
我正在为我的一个移动应用程序的后端创建一个 Python 服务器。我正在为 python 服务器使用 http.server.BaseHTTPRequestHandler 类。我还使用 Nginx 作为反向代理,将请求重新路由到我的 python 服务器。所有这些都在 DigitalOcean Ubuntu 机器上。我为 python 服务器创建了 systemd 服务文件来执行脚本。通常当我重新启动服务时,它会运行一两天完全正常,但随后我得到一个 504 Bad Gateway。在查看我的 python 服务器的日志时,我得到了这个:
-[31/Oct/2021 01:07:32] "GET / HTTP/1.0" 400 -
-[31/Oct/2021 01:07:38] "GET / HTTP/1.0" 400 -
-[31/Oct/2021 01:07:38] "GET /nmaplowercheck1635642271 HTTP/1.1" 400 -
-[31/Oct/2021 01:07:38] "POST /sdk HTTP/1.1" 400 -
-[31/Oct/2021 01:07:38] "GET /evox/about HTTP/1.1" 400 -
-[31/Oct/2021 01:07:38] "GET /HNAP1 HTTP/1.1" 400 -
-[31/Oct/2021 01:07:39] "GET / HTTP/1.0" 400 -
-[31/Oct/2021 01:07:39] "GET / HTTP/1.1" 400 -
-[31/Oct/2021 01:08:02] "GET / HTTP/1.1" 400 -
-[31/Oct/2021 01:08:03] "GET /favicon.ico HTTP/1.1" 400 -
-[31/Oct/2021 01:55:46] "GET /config/getuser?index=0 HTTP/1.1" 400 -
-[31/Oct/2021 02:45:56] "GET / HTTP/1.1" 400 -
-[31/Oct/2021 03:09:50] code 400, message Bad request syntax ('\x05\x01\x00')
-[31/Oct/2021 04:14:39] "GET /config/getuser?index=0 HTTP/1.1" 400 -
-[31/Oct/2021 05:33:06] "GET / HTTP/1.1" 400 -
-[31/Oct/2021 05:33:23] "POST /api/jsonws/invoke HTTP/1.1" 400 -
-[31/Oct/2021 09:05:12] code 400, message Bad request version ('»_ô\x00\x01<Ì\x14Ì\x13Ì\x15À0>
-[31/Oct/2021 09:49:57] "GET / HTTP/1.1" 400 -
Nginx 错误日志给了我这个:upstream timed out (110: Connection timed out) while connection to upstream
这是 Nginx 还是 python 的问题?
解决方案
推荐阅读
- javascript - 我怎样才能让这个倒计时每秒更新一次?
- video - 如何将 ffprobe 转储的元数据复制到转换后的视频
- vb.net - 在用户控件中单击属性时打开“编辑列”时出错
- python - 使用 Windows 从命令行调用 Python 脚本(在 PATH 中的目录中)
- ios - 如何在 iOS 13 中获取移动信号强度?
- windows - Dim b As Integer = Integer.Parse("1") 导致“System.FormatException:'输入字符串的格式不正确。'”
- docker - 容器化 Nifi s2s 问题
- java - 在java中比较2个大对象的最快方法
- python - Django - 如何在同一字典中获取模型中选择字段的计数
- ios - SwiftUI 表单图标