Apache 文件根目录设置修改方法 (Document Root)
更新时间:2012年01月30日 12:33:36 作者:
最近在学习WordPress,使用appServ 在windows上搭建Php开发环境
在网上查找到的关于修改Apache服务器根目录的资料,对比学习,再此记录
在安装 Apache 时,系统会给定一个缺省的文件根目录。
如果你觉得将网页存在这个缺省目录不方便,觉得应该另外设个目录作为 Apache 文件根目录,你可以修改 Apache 的配置文件 httpd.conf 里有关文件根目录的设置。
假设Apache HTTP Server 的缺省文件根目录 (DocumentRoot) 是:
DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"
修改 Apache 文件根目录 (DocumentRoot) 的操作如下:
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 文件中的如下内容
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
将 Diectory 中的路径改成你新设的文件根目录,比如:
<Directory "C:/htdocs">
4. 保存配置文件http.conf 。
5. 修改了配置文件以后,应重新启动 Apache Service。(Start --> All Programs --> Apache HTTP Server 2.2 --> Monitor Apache Servers --> Restart)
修改了文件根目录之后,你就可以将你的网页存放在新设的目录下了。
在安装 Apache 时,系统会给定一个缺省的文件根目录。
如果你觉得将网页存在这个缺省目录不方便,觉得应该另外设个目录作为 Apache 文件根目录,你可以修改 Apache 的配置文件 httpd.conf 里有关文件根目录的设置。
假设Apache HTTP Server 的缺省文件根目录 (DocumentRoot) 是:
DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"
修改 Apache 文件根目录 (DocumentRoot) 的操作如下:
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 文件中的如下内容
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
将 Diectory 中的路径改成你新设的文件根目录,比如:
<Directory "C:/htdocs">
4. 保存配置文件http.conf 。
5. 修改了配置文件以后,应重新启动 Apache Service。(Start --> All Programs --> Apache HTTP Server 2.2 --> Monitor Apache Servers --> Restart)
修改了文件根目录之后,你就可以将你的网页存放在新设的目录下了。
相关文章
解决IIS8.5中ASP上传大文件出现 Request 对象 错误 ASP 0104 : 80004005 错误的方法
这篇文章主要介绍了解决IIS8.5中ASP上传大文件出现 Request 对象 错误 ASP 0104 : 80004005 错误的方法,需要的朋友可以参考下2015-10-10
windows下apache+php+mysql 环境配置方法
很多朋友想要在window下配置apache+php+mysql运行环境,其实从这么长时间的经验来看,win2003下还是用iis,如果为了学习或对apache特别熟悉的朋友可以用apache2012-04-04
关于windows server 2012 DC 环境 重启后蓝屏代码:0xc00002e2的问题
这篇文章主要介绍了windows server 2012 DC 环境 重启后蓝屏蓝屏代码: 0xc00002e2 ,解决方法是通过进入目录修改,查找ntds.dit问题,需要的朋友可以参考下2022-05-05
IIS6批量添加主机头 IIS6批量绑定主机头(利用IIS6导入导出XML)
因为对iis6添加了很多的主机头,如果一个一个的添加很累,所以想到了批量添加,经过测试发现,可以用如下方法2012-12-12


最新评论