windows配置並啟動apache的方法


步驟一 Cmd打開命令行窗口,切換到apache安裝目錄下

cd  D:\Program Files\Apache2.2\bin

步驟二 安裝apache服務

httpd.exe -k install

備注:不懂得話可以查看幫助:httpd.exe -help

步驟三 修改配置文件

編輯文件:<安裝目錄>\conf\httpd.conf

步驟四測試該服務的配置文件

httpd.exe -n "MyServiceName" –t

步驟五啟動已安裝的apache服務

httpd.exe -k start

步驟六測試安裝結果

http://localhost:port

FAQ

1. 未安裝服務,現象如下圖示——解決方案:執行步驟一、步驟二

右下角顯示

雙擊打開右下角圖標,顯示

2. 配置文件錯誤,現象如下圖示——解決方案:執行步驟三

知識擴展

1. 安裝/卸載Apache服務

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"

2. 管理Apache服務

1) 啟動已安裝的Apache服務

httpd.exe -k start

2) 停止已安裝的Apache服務

httpd.exe -k stop || httpd.exe -k shutdown

3) 重啟已安裝的Apache服務(迫使服務重讀配置文件,適用於修改配置文件后)

httpd.exe -k restart

 

出處:https://blog.csdn.net/weixin_37909363/article/details/80332733


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM