Apache-2.2

Apache2 configtest 分段錯誤

  • March 21, 2017

無論出於何種原因,我設法把 Apache 搞得一團糟(Ubuntu 12.04)。下面的輸出抱怨 configtest 失敗和分段錯誤。但是,我在/var/log/apache2/error.log. 如何調試這個“configtest”?

jeroen@jeroen-ubuntu:~$ sudo service apache2 stop
* Stopping web server apache2                                                  
* The apache2 configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
... waiting                                                             [ OK ]
jeroen@jeroen-ubuntu:~$ sudo service apache2 start
* Starting web server apache2
Segmentation fault
Action 'start' failed.
The Apache error log may have more information.
                                                                    [fail]

編輯:問題與載入 apache2 模組有關。我發現了一些問題的痕跡/var/log/kern.log

Mar 14 20:44:27 jeroen-ubuntu kernel: [13267.367260] show_signal_msg: 9 callbacks suppressed
Mar 14 20:44:27 jeroen-ubuntu kernel: [13267.367264] apache2[20784]: segfault at b638f7b5 ip b638f7b5 sp b5ed42e0 error 14
Mar 14 20:44:27 jeroen-ubuntu kernel: [13267.367268] apache2[20786]: segfault at b638f7b5 ip b638f7b5 sp b383f2e0 error 14

我使用這個模組已經很多年了,它一直很穩定。我最近一直在從 PPA 儲存庫安裝一些反向移植,我懷疑其中一個包破壞了我的系統……

如果configtest失敗了,那也沒什麼好恐慌的。這基本上意味著您的一個 Apache 配置文件中有問題。所以這是我應該做的事情的清單:

  1. 在這發生之前,您是否正在編輯 Apache 配置文件?哪一個?在哪裡?您可以為其恢復備份或已知的良好配置嗎?基本上,我會用細齒梳子檢查配置。像配置選項中的拼寫錯誤這樣簡單的事情可能是原因。還是文件損壞了?
  2. 這是在主要配置上/etc/apache2/apache2.conf還是在什麼地方/etc/apache2/sites-enabled?如果它在主配置文件中,它會error.log經常出現嗎?如果沒有,也許在連接到您的虛擬主機的單獨日誌中?
  3. 執行時您的虛擬主機配置是什麼樣的sudo apachectl -S?這可能會為 Apache 使用的配置提供另一個線索。
  4. 過去,您是否向 Apache 添加或嘗試添加任何模組?你能禁用它們嗎?您在一些評論答案中指出該模組可能是原因。不要嫁給一個可替換的軟體。只需刪除它並重新安裝模組。可能是腐敗的。
  5. 絕對最壞的情況,除非你有一個非常特殊的 Apache 安裝——我建議你備份你的配置——/etc/apache2從你的系統中刪除 Apache 並重新安裝它。然後查看該全新安裝是否有效,如果有效,則根據備份文件重做配置。

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