禁用CentOS下Apache的测试页面

来源:互联网 发布:掌趣科技 涵凌网络 编辑:程序博客网 时间:2024/04/30 03:57
禁用CentOS下Apache的测试页面
 
在CentOS中安装apache并启动后,默认CentOS会为Apache添加一个测试页面,安装完毕并且对Apache的保持默认配置,之后在浏览器中输入你的站点的域名或ip地址,浏览器会打开如下界面
该界面是用来测试Apache服务器是否工作正常。
 
禁用该测试页面的方法如下:
 
1.打开终端,登陆到CentOS上
 
2.在终端中输入以下命令
 
cd /etc/httpd/conf.d
3.继续输入命令,显示当前目录下的文件
 
ls
4.找到名为welcome.conf的文件,并用vim打开
 
vim welcome.conf
welcome.conf的内容如下
 
# 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的内容注释掉即可,如下:
 
# 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
0 0
原创粉丝点击