网页访问出现 You don't have permission to access /index.html on this server. 在虚机/服务器上的解决方法

虚机问题

昨天虚机上传网页,打开测试页面的时候出现如下错误: Forbidden. You don’t have permission to access /index.html on this server. 开始我以为我网页出错,后来发现是权限问题,立马搞定了. 原因:index.html是用root用户建的文件,虚机上权限限制且无法修改,只能修改网页访问权限。 解决方法: 更改文件权限:chmod 755 index.html 或者在ftp软件中设置该文件权限

配置修改

如果是WinServer下出现这个问题,请打开apache下配置文件httpd.conf,找到:

1
2
3
4
5
6
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
deny from all
</Directory>

然后试着把deny from all中的deny改成了allow,保存后重起apache,测试网站就可以访问了。