Apache禁用测试页(默认页)

该界面是用来测试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

版权声明:
作者:超级管理员
链接: https://apecloud.ltd/article/detail.html?id=18
来源:猿码云个人技术站
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
/static/admin/img/weixin.jpg/static/admin/img/zfb.jpg
<<上一篇>
远程登录CentOS,短时间就断线的处理
下一篇>>