分享

禁用CentOS下Apache的测试页面

 明天网吧 2015-09-18
禁用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条评论

    发表

    请遵守用户 评论公约

    类似文章 更多