Apache故障解決一例

來源:互聯網
上載者:User
故障現象:
在一台伺服器上,以wacos使用者啟動apache進程,啟動後立刻使用命令ps –ef | grep httpd能夠看到一個進程被啟動,但是稍候訪問web介面就報錯,再使用命令ps –ef | grep httpd,發現進程已經宕掉。
    詢問現場工程師進行過的操作以後,得知之前進行了服務連接埠的重新綁定。
    檢查apache的錯誤記錄檔檔案error_log,發現有如下的警示:
[warn] pid file /opt/wacos/tools/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?

故障描述:
在一台伺服器上,以wacos使用者啟動apache進程,啟動後立刻使用命令ps –ef | grep httpd能夠看到一個進程被啟動,但是稍候訪問web介面就報錯,再使用命令ps –ef | grep httpd,發現進程已經宕掉。
    詢問現場工程師進行過的操作以後,得知之前進行了服務連接埠的重新綁定。
    檢查apache的錯誤記錄檔檔案error_log,發現有如下的警示:
[warn] pid file /opt/wacos/tools/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?

懷疑與Apache的pid記錄檔案或者設定檔有關(因為現場改動了apache的監聽連接埠)。於是開啟兩個登入視窗,一個視窗用tail –f error_log監視錯誤記錄檔檔案的輸出情況,另一個視窗則啟動apache的服務。
    在啟動apache後,發現錯誤記錄檔檔案輸出如下內容:
[Thu Jun 24 21:54:27 2004] [warn] pid file /opt/wacos/tools/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
fopen: Permission denied
httpd: could not log pid to file /opt/wacos/tools/apache/logs/httpd.pid

    進入到/opt/wacos/tools/apache/logs使用ls –l httpd.pid檢查httpd.pid檔案的屬性,發現該檔案的屬性如下:
-rw-r--r--   1 root    others            4 Jun 25 14:58 httpd.pid
    其屬主是root,而且又沒有向其他使用者放開寫入權限,使用wacos使用者啟動apache,apache試圖改寫httpd.pid檔案時,肯定就會失敗了。而這個檔案記錄了apache啟動後的進程標識(PID,Process ID),對於httpd服務有著及其重要的作用,這樣httpd進程當然會退出了。

故障分析:
估計是有相關的人員在日常維護中,使用root使用者啟動apache,導致httpd.pid檔案的屬主變成了root,導致後來使用wacos使用者啟動apache時,Apache會嘗試寫httpd.pid以便記錄自己的pid進程號,但是由於httpd.pid目前的屬主是root使用wacos使用者修改httpd.pid檔案肯定會失敗。

故障處理:
定位到了問題以後,採用了如下的解決方案。
    進入到/opt/wacos/tools/apache/logs目錄,刪除httpd.pid檔案。然後以wacos使用者重新啟動apache,成功啟動apache。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.