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.
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:
Post a Comment