Warning: DocumentRoot does not exist

If you're using Red Hat Enterprise Linux (RHEL) or one of it's variants (CentOS, etc.), you may have noticed that using a non-standard document root for your Apache-based web site results in a DocumentRoot does not exist warning if the directory exists. The most likely cause of this problem is <acronym title="Security-Enhanced Linux">SELinux</acronym>.

The fix for the problem is to change the security context of your new DocumentRoot to match that of the system's original document root. Here's how:

$ ls -la --context /var/www/html
drwxr-xr-x  root root system_u:object_r:httpd_sys_content_t .
$ chcon -R system_u:object_r:httpd_sys_content_t /new/docroot

Obviously, /new/docroot in the example above should be the path to your document root.

My Bookshelf

Reading Now

Other Stuff