首页 > 解决方案 > Ubuntu 18.04 Apache 在 AWS EC2 中自动为基于 NodeJS Angular 的应用程序频繁崩溃并停止

问题描述

我在 AWS EC2 实例免费层上使用 Ubuntu 18.04,在 Apache 服务器上运行网站,NodeJS 和 PostgreSQL 数据库。所有部署都完美完成,网络应用程序运行良好,没有任何异常或错误细节。

但是我面临一个烦人的问题:这个实例经常停止,没有任何异常或错误日志。重新启动实例后,一切都开始正常工作,但一段时间后它会在几小时内自动停止。在重启实例的同一天或之后的 1-2 天。

以下是我尝试分析的一些 Apache 日志 (var/log/apache2),但找不到确切的原因:[有错误日志看起来与此相关:

**[Sun Jul 05 14:11:30.444362 2020] [mpm_event:notice] [pid 1007:tid 140440680164288] AH00491: caught SIGTERM, shutting down]** ]



[Sun Jul 05 13:10:44.389403 2020] [mpm_event:notice] [pid 1007:tid 140440680164288] AH00489: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Jul 05 13:10:44.389524 2020] [core:notice] [pid 1007:tid 140440680164288] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jul 05 13:10:55.517856 2020] [proxy:error] [pid 1009:tid 140440540890880] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:4200 (localhost) failed
[Sun Jul 05 13:10:55.517921 2020] [proxy_http:error] [pid 1009:tid 140440540890880] [client 27.97.147.181:32952] AH01114: HTTP: failed to make connection to backend: localhost
[Sun Jul 05 13:10:55.969159 2020] [proxy:error] [pid 1008:tid 140440582854400] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:4200 (localhost) failed
[Sun Jul 05 13:10:55.969223 2020] [proxy_http:error] [pid 1008:tid 140440582854400] [client 27.97.147.181:25642] AH01114: HTTP: failed to make connection to backend: localhost, referer: http://xx.xx.xx.x6x/
[Sun Jul 05 13:10:59.352669 2020] [proxy:error] [pid 1009:tid 140440549283584] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:4200 (localhost) failed
[Sun Jul 05 13:10:59.352711 2020] [proxy_http:error] [pid 1009:tid 140440549283584] [client 27.97.147.181:12476] AH01114: HTTP: failed to make connection to backend: localhost
[Sun Jul 05 13:10:59.687423 2020] [proxy:error] [pid 1008:tid 140440574461696] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:4200 (localhost) failed
[Sun Jul 05 13:10:59.687463 2020] [proxy_http:error] [pid 1008:tid 140440574461696] [client 27.97.147.181:26001] AH01114: HTTP: failed to make connection to backend: localhost, referer: http://xx.xx.xx.x6x/
[Sun Jul 05 13:11:26.091717 2020] [proxy:error] [pid 1009:tid 140440557676288] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:4200 (localhost) failed
[Sun Jul 05 13:11:26.091772 2020] [proxy_http:error] [pid 1009:tid 140440557676288] [client 27.97.147.181:38107] AH01114: HTTP: failed to make connection to backend: localhost
[Sun Jul 05 13:11:26.420448 2020] [proxy:error] [pid 1009:tid 140440464520960] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:4200 (localhost) failed
[Sun Jul 05 13:11:26.420481 2020] [proxy_http:error] [pid 1009:tid 140440464520960] [client 27.97.147.181:58238] AH01114: HTTP: failed to make connection to backend: localhost, referer: http://xx.xx.xx.x6x/
[Sun Jul 05 14:11:25.939273 2020] [proxy_http:error] [pid 1009:tid 140440557676288] (104)Connection reset by peer: [client 27.97.43.52:50804] AH01102: error reading status line from remote server localhost:4200, referer: http://domain-name.com/sockjs-node/iframe.html
[Sun Jul 05 14:11:25.980501 2020] [proxy:error] [pid 1009:tid 140440557676288] [client 27.97.43.52:50804] AH00898: Error reading from remote server returned by /__webpack_dev_server__/sockjs.bundle.js, referer: http://domain-name.com/sockjs-node/iframe.html
[Sun Jul 05 14:11:30.444362 2020] [mpm_event:notice] [pid 1007:tid 140440680164288] AH00491: caught SIGTERM, shutting down
[Sun Jul 05 14:13:35.011864 2020] [mpm_event:notice] [pid 995:tid 140269259320256] AH00489: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Jul 05 14:13:35.156051 2020] [core:notice] [pid 995:tid 140269259320256] AH00094: Command line: '/usr/sbin/apache2'

标签: node.jsangularapacheamazon-ec2ubuntu-18.04

解决方案


我以前见过这种类型的问题,它是 DNS 问题。经过大量搜索,我发现我的域的 DNS 没有正确注册。


推荐阅读