如下图所示:
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
的地方。
网友评论