Linux

無法啟動 Apache 伺服器

  • October 5, 2020

我嘗試配置我的網頁 SSL 證書,配置後我重新啟動了 Apache 服務,輸出如下:

httpd24-httpd.service - The Apache HTTP Server
  Loaded: loaded (/usr/lib/systemd/system/httpd24-httpd.service; disabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Tue 2018-11-27 12:32:27 EST; 23s ago
 Process: 22104 ExecStop=/opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper $OPTIONS -k graceful-stop (code=exited, status=1/FAILURE)
 Process: 22102 ExecStart=/opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 22102 (code=exited, status=1/FAILURE)

Nov 27 12:32:27 swlt.pok.ibm.com systemd[1]: Starting The Apache HTTP Server...
Nov 27 12:32:27 swlt.pok.ibm.com httpd-scl-wrapper[22102]: /opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper: line 7: /opt/rh/httpd24/service-environment: No such file or directory
Nov 27 12:32:27 swlt.pok.ibm.com systemd[1]: httpd24-httpd.service: main process exited, code=exited, status=1/FAILURE
Nov 27 12:32:27 swlt.pok.ibm.com httpd-scl-wrapper[22104]: /opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper: line 7: /opt/rh/httpd24/service-environment: No such file or directory
Nov 27 12:32:27 swlt.pok.ibm.com systemd[1]: httpd24-httpd.service: control process exited, code=exited status=1
Nov 27 12:32:27 swlt.pok.ibm.com systemd[1]: Failed to start The Apache HTTP Server.
Nov 27 12:32:27 swlt.pok.ibm.com systemd[1]: Unit httpd24-httpd.service entered failed state.
Nov 27 12:32:27 swlt.pok.ibm.com systemd[1]: httpd24-httpd.service failed.

生成了我的 SSL 文件,與keycrtpem一樣多。

我檢查了這條線:

/opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper: line 7: /opt/rh/httpd24/service-environment: No such file or directory

這是我的文件 /opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper:

#!/bin/sh
. /opt/rh/httpd24/service-environment         ##Line 7
for sclname in $HTTPD24_HTTPD_SCLS_ENABLED ; do
   . /opt/rh/$sclname/enable
   export X_SCLS="$X_SCLS $sclname"
done

exec /opt/rh/httpd24/root/usr/sbin/httpd "$@"

我想知道在這種情況下會發生什麼。謝謝你。

消息很清楚:/opt/rh/httpd24/service-environment應該獲取的文件##Line 7不存在(或者可能由於某些 SELinux 問題而無法讀取)。

引用自:https://serverfault.com/questions/941873