WenRou's Blog

新浪微薄腾讯微薄

最新碎语:测试图片碎语哦

您的位置:WenRou's Blog >lnamp> Apache中设置默认首页的方法

Apache中设置默认首页的方法

在你安装后的Apache目录下,有一个conf目录,在这个目录里,有一个"httpd.conf"文件.我们要做的,就是修改这个文件.
通常位于:/etc/httpd/conf/httpd.conf。

    在这个文件里,凡是以"#"开头的每一行,都是无效的,如果你想让你的设置起作用,就要把行首的"#"去掉.

    找到 DirectoryIndex  这段.把它改成DirectoryIndex  index.php index.Html index.html  
    这样,你的网站目录的默认首页是 index.php, 如果没有index.php系统会自动寻找index.html、html做为默认首页了。
    注意事项:index.php index.Html之间要有一个空格

    另外你还可以操作一下其它的:
    找到 ServerRoot 这段.将它设成你的Apache安装目录,
    找到 DocumentRoot 这段.把他设成你网站的根目录,

     然后重启apache:/etc/init.d/httpd restart


总结:
修改apache默认主页要修改两个文件:
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/php.conf
修改这两个文件的 DirectoryIndex  后的文件名。



---

转载请注明本文标题和链接:《Apache中设置默认首页的方法

发表评论

12 + 3 =
路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交