Redhat – 403 Forbidden Errors on Red Hat server

apache-2.4redhat

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?

Best Answer

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