1) 安裝apache服務
httpd.exe -k install
2) 指定要安裝的服務的名稱(適用於電腦上有幾個不同的Apache服務設施)
httpd.exe -k install -n “MyServiceName”
3) 指定服務配置文件的路徑和名稱
httpd.exe -k install -n “MyServiceName” -f “c:\files\my.conf”
注:若不使用特殊參數(如httpd.exe -k install),服務名稱爲Apache2.X,配置文件爲conf\httpd.conf
4) 移除一個Apache服務
httpd.exe -k uninstall
5) 移除特定的Apache服務
httpd.exe -k uninstall -n “MyServiceName”
- 管理Apache服務
1) 啓動已安裝的Apache服務
httpd.exe -k start
2) 停止已安裝的Apache服務
httpd.exe -k stop || httpd.exe -k shutdown
3) 重啓已安裝的Apache服務(迫使服務重讀配置文件,適用於修改配置文件後)
httpd.exe -k restart