CentOS Apache HTTPD Configuration (403 Forbidden)

Solution 1:

You are using a stock install of CentOS, if that is correct please check that if SELinux is in Enforcing mode

getenforce

if the result is "Enforcing"

temporally change it to permissive

setenforce 0

and try again, you can also guide the condition of web content to the files in your home directory.

Solution 2:

Disable SELinux or run in ROOT

setsebool -P httpd_enable_homedirs on
chcon -R -t httpd_sys_content_t /home/
chcon -R -t httpd_sys_rw_content_t /home/

Solution 3:

Freaktor's answer of 'setenforce 0' did "work" for me (thanks!)

But to keep it working and re-enable SELinux, I needed to

sudo chcon -Rv --type=httpd_t /path/to/my/files

...this gave my directory and all files and directories within it the security context of "httpd_t" which is a clunky way of saying SELinux let httpd read those files.

enabling selinux again was as simple as

setenforce 1

Solution 4:

You probably have a deny all somewhere in the global config. Try adding this to the vhost stanza:

<Directory /home/mcmoddr/www>
  Order allow,deny
  Allow from all
</Directory>