您的位置:首页 > 运维架构 > Apache

web服务器中默认首页和默认网站的配置(以apache服务器为例)

2014-01-03 16:26 579 查看
默认首页的配置:

第一种:直接修改apache服务器的配置文件./conf/httpd.conf中的DirectoryIndex,如:(项目web以index.php为首页)

<IfModule dir_module>

DirectoryIndex index.html index.php

</IfModule>

第二种:apache服务器的配置文件./conf/httpd.conf中DirectoryIndex默认不变为index.html,此时需要当前项目下增加一个index.html文件,文件的内容如下编辑:(项目web以index.php为首页)

index.html文件的内容如下:

<meta http-equiv="refresh" content="0; url=index.php">

以上两种方式,在地址栏中输入http://localhost/web就可以直接访问到index.php的页面。

默认网站的配置:(项目以web为例)

第一种:直接修改apache服务器的配置文件./conf/httpd.conf中的DocumentRoot和Directory,如:

DocumentRoot "/usr/local/apache/htdocs/web"

<Directory "/usr/local/apache/htdocs/web">

第二种:不修改apache服务器的默认配置文件httpd.conf,而是,修改./htdocs/目录下的index.html文件:

index.html文件的内容如下:

<meta http-equiv="refresh" content="0; url=/web">

以上两种方式,在地址栏中输入http://localhost就可以直接访问到web项目的网站。

转自: http://blog.csdn.net/morgan363/article/details/4575634
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: