我無法在 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