Friday, 11 January 2013

Using custom folder as DocumentRoot in httpd CentOS


If you use different directory as DocumentRoot (for example /website), httpd will complaint and show you this error message:

DocumentRoot must be a directory

This is due to the Security-Enhanced Linux (SELinux) which is a mandatory access control security mechanism implemented in kernel. For more info you can visit SELinux@wikipedia

To overcome this problem, we need to set the proper access control to our website folder so that it can be recognized by apache httpd

sudo chcon -Rv --type=httpd_sys_content_t /website

No comments: