我的 Apache 2.4.10 服务器开始出现不稳定行为:它连续第三次在半夜关闭,而且没有明显原因。
$ service apache2 status
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Drop-In: /lib/systemd/system/apache2.service.d
└─forking.conf
Active: inactive (dead) since Pk 2020-05-15 00:09:03 UTC; 7h ago
Process: 24771 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 10366 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 22659 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
mai 14 18:06:53 ip-172-30-0-106 systemd[1]: Starting LSB: Apache2 web server...
mai 14 18:06:53 ip-172-30-0-106 apache2[22659]: Starting web server: apache2...g
mai 14 18:06:53 ip-172-30-0-106 apache2[22659]: [Thu May 14 18:06:53.412357 ...g
mai 14 18:06:54 ip-172-30-0-106 apache2[22659]: .
mai 14 18:06:54 ip-172-30-0-106 systemd[1]: Started LSB: Apache2 web server.
mai 15 00:09:03 ip-172-30-0-106 apache2[24771]: Stopping web server: apache2.
以下是 2020-05-15 00:09:03 UTC 左右 error.log 的摘录:
$ tail /var/log/apache2/error.log.1
[Fri May 15 00:08:59.195227 2020] [:error] [pid 22718] [client (IP:port removed)] script '/var/www/404/index.php' not found or unable to stat
[Fri May 15 00:09:00.356207 2020] [:error] [pid 22683] [client (IP:port removed)] script '/var/www/404/index.php' not found or unable to stat
[Fri May 15 00:09:03.100670 2020] [mpm_prefork:notice] [pid 22674] AH00169: caught SIGTERM, shutting down
[Fri May 15 00:09:11.467042 2020] [so:warn] [pid 24785] AH01574: module proxy_module is already loaded, skipping
[Fri May 15 00:09:11.467066 2020] [so:warn] [pid 24785] AH01574: module proxy_http_module is already loaded, skipping
[Fri May 15 00:09:11.487750 2020] [wsgi:warn] [pid 24786] mod_wsgi: Compiled for Python/2.7.8.
[Fri May 15 00:09:11.487766 2020] [wsgi:warn] [pid 24786] mod_wsgi: Runtime using Python/2.7.9.
[Fri May 15 00:09:11.492791 2020] [mpm_prefork:notice] [pid 24786] AH00163: Apache/2.4.10 (Debian) OpenSSL/1.0.1t mod_wsgi/4.3.0 Python/2.7.9 configured -- resuming normal operations
[Fri May 15 00:09:11.492809 2020] [core:notice] [pid 24786] AH00094: Command line: '/usr/sbin/apache2'
[Fri May 15 00:09:11.635360 2020] [mpm_prefork:notice] [pid 24786] AH00169: caught SIGTERM, shutting down
发生此类故障后,只需让service apache2 start
服务器继续运行,直到下一次故障。Apache2 进程会定期启动和关闭,这并不罕见。但是什么原因导致服务器完全死机?是否有其他日志可以进一步检查当时的情况?