禁用CentOS下Apache的测试页面

在CentOS中安装apache并启动后,默认CentOS会为Apache添加一个测试页面,安装完毕而且对Apache的保持默认配置,以后在浏览器中输入你的站点的域名或ip地址,浏览器会打开以下界面html

在此输入图片描述

该界面是用来测试Apache服务器是否工做正常。apache

禁用该测试页面的方法以下:vim

1.打开终端,登录到CentOS上浏览器

2.在终端中输入如下命令服务器

cd /etc/httpd/conf.d

3.继续输入命令,显示当前目录下的文件测试

ls

4.找到名为welcome.conf的文件,并用vim打开rest

vim welcome.conf

welcome.conf的内容以下code

# 
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL.  To disable the Welcome page, comment
# out all the lines below.
#
<LocationMatch "^/+$">
    Options -Indexes
	ErrorDocument 403 /error/noindex.html
</LocationMatch>

文件中的说明性内容说明了该文件的主要做用,以及关闭该做用的方法。其实该文件也是一个普通的配置文件,并被包含进了Apache服务器httpd.conf主文件中,只要用"#"将welcome.conf的内容注释掉便可,以下:htm

# 
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL.  To disable the Welcome page, comment
# out all the lines below.
#
#<LocationMatch "^/+$">
#    Options -Indexes
#	ErrorDocument 403 /error/noindex.html
#</LocationMatch>

5.从新启动Apache图片

service httpd restart

:查看noindex.html为存放路劲

cd /var/www/error/
ls
相关文章
相关标签/搜索