我有一个新的 Debian 不稳定版本,上面有 apache2。Apache 本身运行良好。如果我使用
sudo service apache2 start
它出现了,一切顺利。
但是它的服务每次启动都无法启动。
这里如何追踪错误?
etc/log/apache2/error.log:
[Sun Jan 15 14:51:06.685936 2017] [mpm_prefork:notice] [pid 2208] AH00169: caught SIGTERM, shutting down
[Sun Jan 15 14:51:47.842447 2017] [mpm_prefork:notice] [pid 2200] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 14:51:48.145808 2017] [core:notice] [pid 2200] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 15 14:55:25.766188 2017] [mpm_prefork:notice] [pid 3257] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 14:55:25.801736 2017] [core:notice] [pid 3257] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 15 16:08:15.031691 2017] [mpm_prefork:notice] [pid 2316] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 16:08:15.043756 2017] [core:notice] [pid 2316] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 16 11:26:33.007967 2017] [mpm_prefork:notice] [pid 2278] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Mon Jan 16 11:26:33.013972 2017] [core:notice] [pid 2278] AH00094: Command line: '/usr/sbin/apache2'
[Tue Jan 17 08:07:35.149382 2017] [mpm_prefork:notice] [pid 3517] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Tue Jan 17 08:07:35.152372 2017] [core:notice] [pid 3517] AH00094: Command line: '/usr/sbin/apache2'
哪些其他文件有助于调试服务故障?
答案1
- 检查运行是否启用了该服务
systemctl --no-page -t service -a | grep apache2
- 如果已禁用,请启用它并启动:
systemctl enable apache2 && systemctl start apache2
- 检查服务是否正常运行
systemctl status apache2
- 如果需要,您可以使用以下命令检查 apache2.service 相关日志:
journalctl --no-page -u apache2.service
笔记.-f
键与journalctl
以及与tail
答案2
系统按设计运行,没有任何问题。听起来你可能只需要使能够服务,使其在启动时启动。
systemctl enable service
您可能需要花一些时间阅读 systemctl/systemd 文档。