Welcome To NetTech Solutions

Warm Welcome to Every Visitor. Here we serve best technical support, all the posts here you find will help you solving and facing the day to day problems.
Every one is welcome to comment on our Posts.

Friday, March 7, 2014

Apache DocumentRoot must be directory

You have created a separate partition for you htdocs folder and mounted it on /path/to/documentroot. However, when you try to start Apache you get following error ‘DocumentRoot must be directory’.

This is due to SELinux to get Apache working you have 2 ways

Crude way:- disable SELinux altogether
Eligible way:- set SELinux context to that directory

___________________________________________________________
Crude way:- disable selinux altogether

Follow below steps:

$ vi /etc/selinux/config
$ Change 'SELINUX=enforcing' to 'SELINUX=disabled'
$ Restart your system
____________________________________________________________   
Eligible way:- set SELinux context to that directory

First check the SELinux context of the directory with following command.

$ ls -laZ /path/to/documentroot

Follow below steps:

$ chcon -R -h -t httpd_sys_content_t /path/to/documentroot

Verify the SELinux context

$ ls -laZ /path/to/documentroot

Restart your Apache and it works :).

Hope this helps and saves your time.

No comments: