apachectl 是 Apache HTTP Server 的前端管理工具,主要用來控制 httpd 守護行程。它可作為 httpd 的啟動前端,也可作為 SysV 初始化腳本使用。
作為前端時,apachectl 會設定必要環境變數,再啟動 httpd 並傳遞參數。作為 SysV 腳本時,它接受單一命令,例如 start、stop、restart,並轉換為對應訊號。
apachectl start:啟動 Apache。
apachectl stop:停止 Apache。
apachectl restart:重新啟動,若未執行則會啟動。
apachectl graceful:優雅重新啟動,不立即中斷既有連線。
apachectl graceful-stop:優雅停止。
apachectl status:顯示簡要狀態。
apachectl fullstatus:顯示完整狀態,需要 mod_status 與文字瀏覽器。
apachectl configtest:檢查設定檔語法。
若 Apache 安裝在非標準路徑,可能需要修改 apachectl 腳本中的路徑設定。重新啟動前建議先做設定檢查,避免服務因語法錯誤而無法啟動。