分享

Apache服务器配置默认首页文件名和网站路径

 浸心阁 2016-01-20

默认首页的配置:

      第一种:直接修改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://www./apache/201404/9487.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多