1. Home
  2. /
  3. Web technology
  4. /
  5. Linux
  6. /
  7. apache
  8. /
  9. [ Apache ] –...

[ Apache ] – 修正 Apache 環境變數

評等結果
點擊便能為這篇文章進行評等!
[評等總次數: 0,平均評等: 0]

最近重啟 Apache 時發現 apache2 有錯誤訊息 Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot,雖然對網站執行沒有什麼問題,有錯誤就就是不舒服;就上網爬爬文找解法如下。

顯示apache來源資訊
指令:apache2 -S

顯示結果
[Tue Jun 29 11:17:55.681925 2021] [core:warn] [pid 13720] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot

修正環境變數
指令:source /etc/apache2/envvars

顯示apache來源資訊
指令:apache2 -S

顯示結果
VirtualHost configuration:
*:443 webteach.tw (/etc/apache2/sites-enabled/webteach.tw-ssl.conf:2)
*:80 is a NameVirtualHost
default server ip-172-31-27-1.ap-northeast-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ip-172-31-27-1.ap-northeast-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost webteach.tw (/etc/apache2/sites-enabled/cdn.webteach.tw.conf:1)
alias cdn.webteach.tw
port 80 namevhost webteach.tw (/etc/apache2/sites-enabled/webteach.tw.conf:1)
alias www.webteach.tw
port 80 namevhost wpdemo.webteach.tw (/etc/apache2/sites-enabled/wpdemo.webteach.tw.conf:1)
alias wpdemo.webteach.tw
ServerRoot: “/etc/apache2”
Main DocumentRoot: “/var/www/html”
Main ErrorLog: “/var/log/apache2/error.log”
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir=”/var/run/apache2/” mechanism=default
PidFile: “/var/run/apache2/apache2.pid”
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name=”www-data” id=33 not_used
Group: name=”www-data” id=33 not_used

參考連結:
https://qastack.cn/ubuntu/927355/ubuntu-apache2-defaultruntimedir-must-be-a-valid-directory-absolute-or-relative

評等結果
點擊便能為這篇文章進行評等!
[評等總次數: 0,平均評等: 0]
!去下營經續永站本助幫能就下一點輕輕,話的您到助幫有章文的我果如 如果我的文章有幫助到您的話,輕輕點一下就能幫助本站永續經營下去!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *