解决网站跳转到Apache 2 Test Page powered by CentOS

如下图所示:

apache2 test page.png

出现这个页面是因为系统默认加载了下面的配置文件:
/etc/httpd/conf.d/welcome.conf
只要修改即可!

[root@iZm5ebjvditkx9x8pm3dw4Z ~]# cd /etc/httpd/conf.d/
[root@iZm5ebjvditkx9x8pm3dw4Z conf.d]# ls
php.conf  README  welcome.conf
[root@iZm5ebjvditkx9x8pm3dw4Z conf.d]# 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>

重启服务器,再次打开网页,如下图所示:


image.png

参考地址:https://segmentfault.com/q/1010000005752202

apahce中web默认根目录:/var/www/html/
如果在/var/www/html/目录中添加index.html文件,就显示index.html中的内容。如果没有index.html文件,就一直显示这个文件。即使在httpd.conf文件中配置了下面的设置:

<Directory "/var/www/html/">
Options Indexes FollowSymLinks
Order allow,deny
allow from all
</Directory>

那这个页面到底在什么地方呀?是否可以删除呀?别急,我找到了。它就是:
/var/www/error/noindex.html
打开看看吧。从放置的位置来看,它认为没有index.html是一个错误操作。它就转到noindex.html这个页面。打开httpd.conf看看,应该可以找到设置noindex.html的地方。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。