这是我第一次使用Amazon EC2。 我正在运行Apache 2.4.6的服务器,当我访问公有DNS或弹性IP时,我似乎无法正常工作。 我得到的错误消息是:
Forbidden You don't have permission to access /index.html on this server.
我已经检查了这个文件的权限(755)。 我的httpd.conf文件中有一个VirtualHost块,如下所示:
Listen 80 NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "/var/www/html" ServerName my-ec2-public-dns-url </VirtualHost>
对于HTTP / HTTPS,AWS中的我的安全组设置都设置为Anywhere。
当我检查错误日志时,它说: AH00132: file permissions deny server access: /var/www/html/index.html
不知道我在做什么错。 谢谢你的帮助。
尝试检查文件上的现有权限:
ls -l index.html
如有必要,修复它们:
chmod 644 index.html
如果所有的标准权限都是正确的,并且仍然收到“ Permission Denied error ,则应该检查扩展权限。 例如,您可以使用命令setenforce 0来closuresSELinux并检查问题是否消失。 如果是这样, ls -alZ可以用来查看SELinux权限和chcon来修复它们。
例如:
sudo chcon -R -v -t httpd_sys_rw_content_t index.html