1.安裝apache;
? ? win+r輸入cmd進(jìn)入dos界面.進(jìn)入到你目錄apache24/bin 輸入httpd.exe -k install 或者h(yuǎn)ttpd.exe -k install -n "apache24"(建議放在你的c盤);
2.安裝VCRUNTIME140.dll;(未提示直接省略2步驟)
? ? ?如果提示計算機(jī)中丟失 VCRUNTIME140.dll,需要下載vc_redist.x86.exe對應(yīng)32位計算機(jī)或vc_redist.x64.exe對應(yīng)64計算機(jī);
https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=48145 (下載地址)
3.啟動apache服務(wù)器查看是否安裝成功;(未成功直接看第5步)
? ? ? httpd.exe -k start;瀏覽器出現(xiàn)下面畫面表示成功
4.停止apache服務(wù)器
? ? httpd.exe -k stop; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
5.修改配置文件 ? ? ? ? ? ? ? ??
? ? 一,修改監(jiān)聽接口:linsten 80;(在上圖位置)
? ? ? ? ? 1.找到Apache安裝目錄下conf目錄下的httpd.conf文件(d:\Apache\conf\httpd.conf)。打開它。
? ? ? ? ? 2.找到“Listen80”,緊接著Listen的數(shù)字就是端口號,我們改為“Listen 8080”。? 修改為其它未使用的端口號也行。
? ? ? ? ?3. 重新啟動Apache,使新的配置生效。httpd.exe -k start。
? ? 二,修改默認(rèn)訪問路徑;(在上圖位置)
? ? ? ? ? 1、到Apache的安裝目錄下找到conf文件夾下的httpd.conf文件。
? ? ? ? ? 2、雙擊打開httpd.conf這個文本文檔,按下鍵盤上的Ctrl+F組合鍵查找 ? DocumentRoot (帶英文雙引號,見圖),查找出來之后(僅有一處),將字符串DocumentRoot后面 雙引號內(nèi)的字符串修改為自己想要設(shè)定的網(wǎng)站目錄。
? ? ? ? ? ? ? 如:默認(rèn)為DocumentRoot "${SRVROOT}/htdocs",現(xiàn)修改成 DocumentRoot ? ? ? ? ? ? ? ? ? ? ? ? D:/Apache
? ? ? ? ? ? ? 如:默認(rèn)為<Directory "${SRVROOT}/htdocs">? ,現(xiàn)修改成<Directory ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? D:/Apache>
? ? ? ? ?3、修改默認(rèn)html文件
? ? ? ? ? ? 雙擊打開httpd.conf文件,ctrl+f? 查找DirectoryIndex index.html ? 把index.html修改未自己的文件
? ? ? ? ? 如DirectoryIndex index.html? 修改為? DirectoryIndex homePage.html
? ? ? ? ?(把自己的文件放在apache24/htdocs文件內(nèi))