I have been trying to get to grips with Apache in CentOS 7.

I have set up two virtual hosts and created basic index.html pages as follows:



Both hosts have permissions as follows:


public_html -> jonathan:jonathan
index.html -> root:root


public_html -> jonathan:jonathan
index.html -> root:root

Now, what is happening is DomainA's index.html page is being served up fine, but domain B's index.html gives me a 403 Forbidden.

DomainB's error.log gives me this:

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

Why is this happening? It makes me very sad.

  • 1
    ¿What filesystem permissions do you have in each directory?
    – motilio
    May 4, 2015 at 20:18
  • 1
    To expand on motilio's comment: please show us the output of ls -ld on all public_html and index.html files and directories, as well as on DomainA and DomainB.
    – dhag
    May 4, 2015 at 20:23
  • 1
    As i was getting the details of the filesystem permissions, i stumbled across the ls -Z command. This highlighted the fact that the working had the httpd_sys_content_t context but the non-working domain had something like user_root_t context. I set this to be httpd_sys_content_t and both domains are now working. Thanks for your help fellas. May 6, 2015 at 7:57

2 Answers 2


The issue turned out not to be file /folder permissions as such, but the security context of the non-working domain.

From my limited understanding, in order for Apache to serve up files, the files / folders need to be configured to run under the httpd_sys_content_d context.

My 'mistake' was the non-working domain had been mv'd into the Apache content folder from my Development area and did not have the correct security context so Apache could not serve up the files. This was confirmed by running ls -Z on the public_html folder and subfolders.

I used chcon -R -t httpd_sys_content_t public_html/ to set the correct security context and now Apache is serving up everything.

  • chcon -R -t httpd_sys_content_t Did the trick
    – Michel
    Dec 21, 2016 at 12:37

chcon -R -t httpd_sys_content_t <Your_Document_Root_Dir>

Should do the trick


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .