Apache httpd.conf 設定檔語法驗證

來源:互聯網
上載者:User

標籤:顯示出錯   資訊   不必要   apach   lin   檔案   syn   行號   window   

Apache 的 httpd.conf檔案改動之後,必須重新啟動server才幹生效。

有時server在提供服務的時候,直接更改配置,重新啟動服務。會帶來非常大的危急性。

假設能在改動配置之後,先驗證文法正確與否,再重新啟動server。則能避免一些不必要的錯誤。

對以上需求,Apache本身提供了對應的命令來驗證設定檔的文法。

Windows環境的命令:

httpd -t


Linux環境的命令:
[[email protected] bin]# ./apachectl configtest


假設正確無誤。會顯示Syntax OK資訊
Syntax OK

假設存在錯誤,則會顯示出錯的行號以及錯誤資訊。例如以下:
AH00526: Syntax error on line 339 of /opt/apache/conf/httpd.conf:

Invalid command ‘a‘, perhaps misspelled or defined by a module not included in the server configuration


Apache httpd.conf 設定檔語法驗證

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.