Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

apachectl 指令完整手冊:Apache HTTP Server 前端控制腳本用法詳解

編輯:Linux 教學

apachectl 定位

apachectl 是 httpd 守護進程的前端控制程式,提供兩種操作模式:

  1. 參數透傳模式:設定環境變數後直接啟動 httpd,傳遞所有命令列參數。
  2. SysV init 模式:接受單字指令(start/restart/stop 等),轉換為對應信號發送給 httpd。

語法

# 透傳模式
apachectl [httpd-argument]

# SysV init 模式
apachectl command

SysV init 指令對照表

指令說明等效參數
start啟動 httpd(已運行則報錯)apachectl -k start
stop立即停止 httpdapachectl -k stop
restart重啟(先 configtest),未運行則啟動apachectl -k restart
graceful優雅重啟(不中斷現有連線,不立即關閉日誌)apachectl -k graceful
graceful-stop優雅停止(等待現有連線完成)apachectl -k graceful-stop
configtest語法檢查(不啟動)apachectl -t
status簡略狀態(需 mod_status + lynx)—
fullstatus完整狀態報表—

進階用法

  • 非標準安裝路徑:編輯 apachectl 修改 HTTPD 變數指向正確 httpd。
  • 自訂 httpd 參數:同樣在腳本中設定。
  • 回傳碼:成功 0,失敗 >0。

已棄用指令

startssl:舊版 SSL 啟動方式,現建議直接在設定檔啟用 SSL 並用 apachectl start。

環境變數

  • STATUSURL:status/fullstatus 存取 URL,預設 https://localhost:80/server-status。
Copyright © Windows教程網 All Rights Reserved