如何設(shè)置修改Apache文件根目錄設(shè)置
在安裝 Apache 時(shí),系統(tǒng)會(huì)給定一個(gè)缺省的文件根目錄。
如果你覺得將網(wǎng)頁(yè)存在這個(gè)缺省目錄不方便,覺得應(yīng)該另外設(shè)個(gè)目錄作為 Apache 文件根目錄,你可以修改 Apache 的配置文件 httpd.conf 里有關(guān)文件根目錄的設(shè)置。
假設(shè)Apache HTTP Server 的缺省文件根目錄 (DocumentRoot) 是:
DocumentRoot "F:ampApache2.2htdocs"
修改 Apache 文件根目錄 (DocumentRoot) 的操作如下:
1. 為避免修改失誤,請(qǐng)先備份你的 Apache 配置文件 httpd.conf,該配置文件的路徑是:
F:ampApache2.2htdocs
2. 打開 http.conf 文件,找到 DocumentRoot 為開頭的那一行,將
DocumentRoot "F:ampApache2.2htdocs"
改成新的 DocumentRoot 路徑,比如你新的路徑為 C:htdocs,就改成
DocumentRoot "C:/htdocs"
3. 然后找到 http.conf 文件中的如下內(nèi)容
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "F:ampApache2.2htdocs">
將 Diectory 中的路徑改成你新設(shè)的文件根目錄,比如:
<Directory "C:/htdocs">
4. 保存配置文件http.conf 。
5. 修改了配置文件以后,應(yīng)重新啟動(dòng) Apache Service。(Apache HTTP Server 2.2 --> --> Restart)
修改了文件根目錄之后,你就可以將你的網(wǎng)頁(yè)存放在新設(shè)的目錄下了