htaccess拒绝所有获取apache服务器测试页面

时间:2012-12-22 08:21:35

标签: apache .htaccess

我已使用zpanel安装了centos 6.3。 现在问题是什么。

我添加了域mydomain.com,并添加了空白index.php文件。 我添加了.htaccess文件,其中包含“拒绝所有人” 现在当我在浏览器中打开页面时,我获得了Apache 2 Test Page而不是403 Forbidden 但如果我打开http://mydomain.com/index.php,现在我得到403 Forbidden。

我尝试编辑apache配置文件Directoryindex,但没有正面结果。有人可以帮帮我吗?

2 个答案:

答案 0 :(得分:2)

尝试禁用默认的Apache CentOS欢迎页面:

#
# 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>

编辑文件/etc/httpd/conf.d/welcome.conf并评论所有内容。只需删除welcome.conf文件(或将其重命名为.conf.disabled)也应该可以解决问题。

然后,重新加载apache配置(service httpd restart),事情应该按预期工作。

答案 1 :(得分:0)

相同的问题,当更新Apache时,已经创建了文件welcome.conf。 我将其重命名为禁用它,现在我可以从所有指令中看到“拒绝”的禁止页面