Home  >  Article  >  Backend Development  >  如何修改和添加Apache的默认站点目录_PHP教程

如何修改和添加Apache的默认站点目录_PHP教程

WBOY
WBOYOriginal
2016-07-21 15:01:34775browse

一、修改Apache的默认站点目录
Apache HTTP Server安装好后,默认的站点目录位于其安装目录下的htdocs文件夹内,默认首页是该文件夹的index.html文件。比如,我的Apache是安装在C:/wamp/bin/apache/Apache2.2.21内,那么我的Apache的完整的默认站点目录地址就是C:/wamp/bin/apache/Apache2.2.21/htdocs/,默认首页就是C:/wamp/bin/apache/Apache2.2.21/htdocs/index.html。

很多时候,不管是学习、测试,还是想真正的搭建自己的站点,我们可能并不想把自己的网站放在Apache默认的站点目录下,这时,本节的知识将会帮助你解决这个问题。

修改方法:
1、
到Apache的安装目录下找到conf文件夹,该文件夹内会httpd.conf这样一个文本文档,它是Apache的配置文件,负责指挥Apache的运行。

2、双击打开httpd.conf这个文本文档,按下键盘上的Ctrl+F组合键查找“DocumentRoot "”(带英文双引号",见图),查找出来之后(仅有一处),将字符串“DocumentRoot”后面双引号内的字符串修改为自己想要设定的网站目录。

如:默认为DocumentRoot "C:/wamp/bin/apache/Apache2.2.21/htdocs",现修改成DocumentRoot "D:/Apache"

3、完成上述第2步之后,暂不要关闭httpd.conf文件,继续查找,查找“

如:默认为,现修改成

4、同时按下键盘上的Ctrl+S组合键保存上述修改,一定记得要停止(STOP)一次Apache服务然后再启动(START),使刚刚的修改生效。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/327994.htmlTechArticle一、修改Apache的默认站点目录 Apache HTTP Server安装好后,默认的站点目录位于其安装目录下的htdocs文件夹内,默认首页是该文件夹的index.ht...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn