大网数据广告活动
服务器运维问答

403 Forbidden Errors on Red Hat server

· 52CE 我爱测

This is my first time using Amazon EC2. I'm running a server with Apache 2.4.6, and I can't seem to get it working when I access the public DNS or Elastic IP address. The error message I get is: Forbidden You don't have permissio…

问题原文

原帖链接 · kaoscify · CC BY-SA 4.0

This is my first time using Amazon EC2. I'm running a server with Apache 2.4.6, and I can't seem to get it working when I access the public DNS or Elastic IP address. The error message I get is:

Forbidden You don't have permission to access /index.html on this server.

I have checked the permissions of this file (755). I have a VirtualHost block in my httpd.conf file as follows:

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/var/www/html"
    ServerName my-ec2-public-dns-url
</VirtualHost>

My Security Group settings in AWS are set to Anywhere for both HTTP and HTTPS.

When I check the error log, it says:

AH00132: file permissions deny server access: /var/www/html/index.html

What am I doing wrong?

已采纳解答

原帖链接 · Federico Sierra · CC BY-SA 3.0

Try check the existing permissions on the file:

ls -l index.html

Fix them if necessary:

chmod 644 index.html

If all the standard permissions are correct and you still get a Permission Denied error, you should check for extended-permissions. For example you can use the command setenforce 0 to turn off SELinux and check to see if the problem goes away. If so, ls -alZ can be used to view SELinux permission and chcon to fix them.

Eg:

sudo chcon -R -v -t httpd_sys_rw_content_t index.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-12-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。