新聞中心
在安裝 Apache 時(shí),系統(tǒng)會(huì)給定一個(gè)缺省的文件根目錄。
如果你覺得將網(wǎng)頁存在這個(gè)缺省目錄不方便,覺得應(yīng)該另外設(shè)個(gè)目錄作為 Apache 文件根目錄,你可以修改 Apache 的配置文件 httpd.conf 里有關(guān)文件根目錄的設(shè)置。
假設(shè)Apache HTTP Server 的缺省文件根目錄 (DocumentRoot) 是:
DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"
修改 Apache 文件根目錄 (DocumentRoot) 的操作如下:

目前創(chuàng)新互聯(lián)已為千余家的企業(yè)提供了網(wǎng)站建設(shè)、域名、雅安服務(wù)器托管、網(wǎng)站托管運(yùn)營、企業(yè)網(wǎng)站設(shè)計(jì)、望城網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。
1. 為避免修改失誤,請先備份你的 Apache 配置文件 httpd.conf,該配置文件的路徑是:
C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
2. 打開 http.conf 文件,找到 DocumentRoot 為開頭的那一行,將
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
改成新的 DocumentRoot 路徑,比如你新的路徑為 C:\htdocs,就改成
DocumentRoot "C:/htdocs"
3. 然后找到 http.conf 文件中的如下內(nèi)容
# This should be changed to whatever you set DocumentRoot to.
#
將 Diectory 中的路徑改成你新設(shè)的文件根目錄,比如:
4. 保存配置文件http.conf 。
5. 修改了配置文件以后,應(yīng)重新啟動(dòng) Apache Service。(Start --> All Programs --> Apache HTTP Server 2.2 --> Monitor Apache Servers --> Restart)
修改了文件根目錄之后,你就可以將你的網(wǎng)頁存放在新設(shè)的目錄下了。
分享標(biāo)題:Apache文件根目錄設(shè)置修改方法(DocumentRoot)
標(biāo)題鏈接:http://m.5511xx.com/article/copiisp.html


咨詢
建站咨詢
