运行带有 Apache2 代理的 Node/JS Web 应用程序的 Ubuntu 服务器出现奇怪的连接失败

运行带有 Apache2 代理的 Node/JS Web 应用程序的 Ubuntu 服务器出现奇怪的连接失败

像这样,我正在通过 Apache 运行 Express JS 应用程序(注意retry=0很重要):

...
   ProxyRequests Off
   ProxyPreserveHost On
   ProxyVia Full
   <Proxy *>
       Require all granted
   </Proxy>
   ProxyPass / http://127.0.0.1:3000/ retry=0
   ProxyPassReverse / http://127.0.0.1:3000/
...

升级某些软件(例如升级到 Ubuntu 20.04 服务器)和互联网网关(Sagecom 5370e)后,我被困在 apache2 服务器无法连接到 localhost:3000 并出现以下细粒度注销,我无法解释。有人能提供一些提示,说明如何继续了解原因吗?

Apache2 详细日志

强调的灰色部分以看似成功的访问/权限协商开始,但之后...HTTP: fam 2 socket created to connect to 127.0.0.1...AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed浏览器 503 错误结束。(为什么fam 2 socket?)

或者在同一个纯文本中(在另一个时间点)找到:

[Tue Aug 10 20:08:28.154152 2021] [http:trace4] [pid 2513680] http_request.c(439): [client 88.83.62.147:50644]   Sec-Fetch-Mode: navigate
[Tue Aug 10 20:08:28.154155 2021] [http:trace4] [pid 2513680] http_request.c(439): [client 88.83.62.147:50644]   Sec-Fetch-Site: none
[Tue Aug 10 20:08:28.154158 2021] [http:trace4] [pid 2513680] http_request.c(439): [client 88.83.62.147:50644]   Sec-Fetch-User: ?1
[Tue Aug 10 20:08:28.154164 2021] [http:trace4] [pid 2513680] http_request.c(439): [client 88.83.62.147:50644]   DNT: 1
[Tue Aug 10 20:08:28.154167 2021] [http:trace4] [pid 2513680] http_request.c(439): [client 88.83.62.147:50644]   Sec-GPC: 1
[Tue Aug 10 20:08:28.154170 2021] [http:trace4] [pid 2513680] http_request.c(439): [client 88.83.62.147:50644]   Cache-Control: max-age=0
[Tue Aug 10 20:08:28.154187 2021] [rewrite:trace2] [pid 2513680] mod_rewrite.c(483): [client 88.83.62.147:50644] 88.83.62.147 - - [mish.hopto.org/sid#7fca5ec89460][rid#7fca612f90a0/initial] init rewrite engine with requested uri /
[Tue Aug 10 20:08:28.154192 2021] [rewrite:trace1] [pid 2513680] mod_rewrite.c(483): [client 88.83.62.147:50644] 88.83.62.147 - - [mish.hopto.org/sid#7fca5ec89460][rid#7fca612f90a0/initial] pass through /
[Tue Aug 10 20:08:28.154196 2021] [proxy:trace2] [pid 2513680] mod_proxy.c(686): [client 88.83.62.147:50644] AH03461: attempting to match URI path '/' against prefix '/' for proxying
[Tue Aug 10 20:08:28.154206 2021] [proxy:trace1] [pid 2513680] mod_proxy.c(772): [client 88.83.62.147:50644] AH03464: URI path '/' matches proxy handler 'proxy:http://127.0.0.1:3000/'
[Tue Aug 10 20:08:28.154224 2021] [authz_core:debug] [pid 2513680] mod_authz_core.c(817): [client 88.83.62.147:50644] AH01626: authorization result of Require all granted: granted
[Tue Aug 10 20:08:28.154228 2021] [authz_core:debug] [pid 2513680] mod_authz_core.c(817): [client 88.83.62.147:50644] AH01626: authorization result of <RequireAny>: granted
[Tue Aug 10 20:08:28.154232 2021] [core:trace3] [pid 2513680] request.c(310): [client 88.83.62.147:50644] request authorized without authentication by access_checker_ex hook: /
[Tue Aug 10 20:08:28.154247 2021] [proxy_http:trace1] [pid 2513680] mod_proxy_http.c(62): [client 88.83.62.147:50644] HTTP: canonicalising URL //127.0.0.1:3000/
[Tue Aug 10 20:08:28.154276 2021] [proxy:trace2] [pid 2513680] proxy_util.c(2131): [client 88.83.62.147:50644] http: found worker http://127.0.0.1:3000/ for http://127.0.0.1:3000/
[Tue Aug 10 20:08:28.154281 2021] [proxy:debug] [pid 2513680] mod_proxy.c(1253): [client 88.83.62.147:50644] AH01143: Running scheme http handler (attempt 0)
[Tue Aug 10 20:08:28.154285 2021] [proxy_http:trace1] [pid 2513680] mod_proxy_http.c(1985): [client 88.83.62.147:50644] HTTP: serving URL http://127.0.0.1:3000/
[Tue Aug 10 20:08:28.154288 2021] [proxy:debug] [pid 2513680] proxy_util.c(2325): AH00942: HTTP: has acquired connection for (127.0.0.1)
[Tue Aug 10 20:08:28.154296 2021] [proxy:debug] [pid 2513680] proxy_util.c(2379): [client 88.83.62.147:50644] AH00944: connecting http://127.0.0.1:3000/ to 127.0.0.1:3000
[Tue Aug 10 20:08:28.154358 2021] [proxy:debug] [pid 2513680] proxy_util.c(2588): [client 88.83.62.147:50644] AH00947: connected / to 127.0.0.1:3000
[Tue Aug 10 20:08:28.154393 2021] [proxy:trace2] [pid 2513680] proxy_util.c(3022): HTTP: fam 2 socket created to connect to 127.0.0.1
[Tue Aug 10 20:08:28.154440 2021] [proxy:error] [pid 2513680] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed
[Tue Aug 10 20:08:28.154459 2021] [proxy_http:error] [pid 2513680] [client 88.83.62.147:50644] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
[Tue Aug 10 20:08:28.154463 2021] [proxy:debug] [pid 2513680] proxy_util.c(2340): AH00943: HTTP: has released connection for (127.0.0.1)
[Tue Aug 10 20:08:28.154495 2021] [http:trace3] [pid 2513680] http_filters.c(1125): [client 88.83.62.147:50644] Response sent with status 503, headers:
[Tue Aug 10 20:08:28.154499 2021] [http:trace5] [pid 2513680] http_filters.c(1134): [client 88.83.62.147:50644]   Date: Tue, 10 Aug 2021 18:08:28 GMT
[Tue Aug 10 20:08:28.154503 2021] [http:trace5] [pid 2513680] http_filters.c(1137): [client 88.83.62.147:50644]   Server: Apache/2.4.41 (Ubuntu)
[Tue Aug 10 20:08:28.154506 2021] [http:trace4] [pid 2513680] http_filters.c(955): [client 88.83.62.147:50644]   Content-Length: 380
[Tue Aug 10 20:08:28.154514 2021] [http:trace4] [pid 2513680] http_filters.c(955): [client 88.83.62.147:50644]   Connection: close
[Tue Aug 10 20:08:28.154517 2021] [http:trace4] [pid 2513680] http_filters.c(955): [client 88.83.62.147:50644]   Content-Type: text/html; charset=iso-8859-1
[Tue Aug 10 20:08:28.154522 2021] [ssl:trace4] [pid 2513680] ssl_engine_io.c(1657): [client 88.83.62.147:50644] coalesce: have 0 bytes, adding 190 more
[Tue Aug 10 20:08:28.154526 2021] [ssl:trace4] [pid 2513680] ssl_engine_io.c(1657): [client 88.83.62.147:50644] coalesce: have 190 bytes, adding 380 more
[Tue Aug 10 20:08:28.154529 2021] [ssl:trace4] [pid 2513680] ssl_engine_io.c(1718): [client 88.83.62.147:50644] coalesce: passing on 570 bytes
[Tue Aug 10 20:08:28.154540 2021] [core:trace8] [pid 2513680] core_filters.c(575): [client 88.83.62.147:50644] brigade contains: bytes: 592, non-file bytes: 592, eor buckets: 0, morphing buckets: 0
[Tue Aug 10 20:08:28.154545 2021] [ssl:trace4] [pid 2513680] ssl_engine_io.c(2207): [client 88.83.62.147:50644] OpenSSL: write 592/592 bytes to BIO#55edbb4540b0 [mem: 55edbb4f45f3] (BIO dump follows)
[Tue Aug 10 20:08:28.154548 2021] [ssl:trace7] [pid 2513680] ssl_engine_io.c(2134): [client 88.83.62.147:50644] +-------------------------------------------------------------------------+
[Tue Aug 10 20:08:28.154554 2021] [ssl:trace7] [pid 2513680] ssl_engine_io.c(2173): [client 88.83.62.147:50644] | 0000: 17 03 03 02 4b 00 8c af-a7 6c 28 46 85 23 66 8f  ....K....l(F.#f. |
[Tue Aug 10 20:08:28.154559 2021] [ssl:trace7] [pid 2513680] ssl_engine_io.c(2173): [client 88.83.62.147:50644] | 0010: bd aa 6b 06 77 a6 17 df-a7 f3 5d 33 e5 a9 94 b7  ..k.w.....]3.... |
[Tue Aug 10 20:08:28.154563 2021] [ssl:trace7] [pid 2513680] ssl_engine_io.c(2173): [client 88.83.62.147:50644] | 0020: a4 b2 be b7 e1 5a 64 20-38 50 d4 96 53 0c cf 19  .....Zd 8P..S... |
[Tue Aug 10 20:08:28.154568 2021] [ssl:trace7] [pid 2513680] ssl_engine_io.c(2173): [client 88.83.62.147:50644] | 0030: ef 10 dc 8d ba bc 1e f1-79 b7 54 2a 93 af 8a c9  ........y.T*.... |
[Tue Aug 10 20:08:28.154573 2021] [ssl:trace7] [pid 2513680] ssl_engine_io.c(2173): [client 88.83.62.147:50644] | 0040: a1 a4 8c 9d a8 2f 3c 1d-3d 48 91 27 c1 bd 44 42  ...../<.=H.'..DB |
[Tue Aug 10 20:08:28.154577 2021] [ssl:trace7] [pid 2513680] ssl_engine_io.c(2173): [client 88.83.62.147:50644] | 0050: 75 8a 5a 4c ff eb 9b ec-cc e4 23 ce 69 cf 13 4d  u.ZL......#.i..M |

我的互联网连接的端口转发和防火墙设置在十天前就成功了(使用 Sagecom 5370e),但设备不在我的控制之下,可能由提供商远程更新。甚至似乎可以通过网关 GUI 准入设置来促进服务器(LAN IP,apache2)与其本地主机(127.0.0.1)之间的通信,但没有成功。——我该如何继续才能至少了解发生了什么?

补充:除了 Apache 日志外,无法在任何其他日志中找到信息。有没有其他方法可以检索信息?一些网络工具?

localhost补充:上网时是否会出现一些额外的困难,在这种情况下通过pm2服务?

补充:@bodo 谢谢(见评论)。日志当然以这种简洁的方式告诉我们没有人在监听 localhost:3000,这就像通过身份验证程序“准备并解锁”一样。我很遗憾没有足够警惕地彻底检查……在线时会标记为已解决,希望很快!

最后:无事生非!只是错过了那个小检查:有人在听吗?(好吧,我很抱歉:总是这样,而且:我确实低估了 js-npm-nvm-node 依赖关系 Web 的复杂性)。很高兴大开眼界...谢谢!

答案1

只是重复:@bodo 谢谢(见评论)。日志当然以这种简洁的方式告诉我们没有人在监听 localhost:3000,这就像通过身份验证程序“准备并解锁”一样。我很遗憾没有足够警惕地彻底检查……在线时会标记已解决,希望很快!

最后:无事生非!只是错过了那个小检查:有人在听吗?(好吧,我很抱歉:总是这样,而且:我确实低估了 js-npm-nvm-node 依赖关系 Web 的复杂性)。很高兴大开眼界...谢谢!

相关内容