我无法在 Debian 9 上重新启动我的 apache 服务器。
我尝试重新安装:
sudo apt-get autoremove --purge apache2 && sudo apt-get install apache2
但没有变化……
Job for apache2.service failed because of unavailable resources or another system error.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "restart" failed.
systemctl 状态 apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: resources)
journalctl -xeu apache2.service(我将日志级别设置为调试模式)
Sep 05 11:45:44 systemd[1]: apache2.service: Failed with result 'resources'.
Sep 05 11:50:26 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:27 systemd[1]: apache2.service: Trying to enqueue job apache2.service/stop/replace
Sep 05 11:50:27 systemd[1]: apache2.service: Installed new job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Enqueued job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Job apache2.service/stop finished, result=done
Sep 05 11:50:27 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:30 systemd[1]: apache2.service: Failed to run 'start' task: No such file or directory
Sep 05 11:50:30 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Sep 05 11:50:30 systemd[1]: apache2.service: Failed with result 'resources'.
怎么了?
答案1
如果您使用默认的 Apache 配置,它会尝试监听已被 nginx 使用的端口 80。请更改您的 Apache 配置以监听端口 88。
listen 88
答案2
您可能需要检查是否存在环境文件。在基于 Debian 的系统中,可以在以下位置找到/etc/default/$file
(不确定实际文件名是什么)在基于 CentOS/RHEL 的系统上,可以在以下位置找到/etc/sysconfig/httpd...
我*添加这个答案是因为我遇到了这个问题,而且格式不是一个选项...所以对于任何可能偶然发现这个问题的人,我都必须自己弄清楚。赠品是启动脚本。
cat /etc/systemd/system/httpd.service | grep -i environment
EnvironmentFile=/etc/sysconfig/httpd