更改Apache的首页

本机Apache的安装过程请见:

Apache的首页是由/usr/local/httpd/conf/httpd.conf文件的DocumentRoot决定的。

...
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.

...

让我们再去/usr/local/apache2/htdocs目录里看看。

[root@bogon conf]# cd /usr/local/apache2/htdocs
[root@bogon htdocs]#
[root@bogon htdocs]# ls
index.html

只有一个index.html显示出来,让我们把它修改下:

[root@bogon htdocs]# vi index.html
<html><title>Apache Title</title><body><h1>Congratulations!Apache works!</h1><br/><h2>2013-08-29</h2></body></html>

然后再访问下看看:

是预想的效果。可以了。

《全文完》

原文地址:https://www.cnblogs.com/heyang78/p/3290533.html